bricks.py

Created by wperez274

Created on April 07, 2023

1.38 KB


from math import *
from random import *
from random import randint as RAND
from kandinsky import *
from kandinsky import fill_rect as F
from kandinsky import draw_string as STR
from ion import *
from ion import keydown as GETKEY
from time import sleep as WAIT

bg=(RAND(0,255),RAND(0,255),RAND(0,255))



def draw_bricks():
  global brick

  brick=[
  [0, 0, 31, 31, (0, 0, 0)], 
  [3, 3, 24, 24, (189, 62, 237)], 
  [9, 6, 17, 21, (180, 31, 180)]
  ]



  for i in range(50,200,32):
    F(i+0, 100, 31, 31, (0, 0, 0))
    F(i+3, 103, 24, 24, (189, 62, 237))
    F(i+9, 106, 17, 21, (180, 31, 180))



def draw_bricks_2():
  global brick
  
  brick_2=[
  [6, 6, 18, 18, (211, 171, 240)], 
  [6, 6, 15, 15, (119, 79, 88)]
  ]
  
  
  for i in range(50,200,19):
      
    F(i+6, 56, 18, 18, (211, 171, 240))
    F(i+6, 56, 15, 15, (119, 79, 88))
    
    




  

def random_background():
  global bg
  
  
  bg=(RAND(0,255),RAND(0,255),RAND(0,255))
  
  F(0,0,322,222,bg)
  
  
  
  
  

F(0,0,322,222,bg)


draw_bricks()
draw_bricks_2()


while not GETKEY(KEY_EXE):
  
  
  
  STR("PRESS [EXE] TO EXIT",40,1,(0,255,0),(0,0,0))
  STR("PRESS [OK] TO CHANGE BACK",60,204,(0,255,255),(0,0,0))
  
  
  
  if GETKEY(KEY_OK):
    WAIT(0.2)
    random_background()
    draw_bricks()
    draw_bricks_2()
    








    
    




    
    
    
STR("PRESS  OK",100,100)

print("")

print("bg=",bg)

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.