Browse Source

+ réglages taille des carrés (demande du prof)

master
ROBINET Julien 4 weeks ago
parent
commit
9345969918
  1. 8
      projet_tkinter_sujet5.py

8
projet_tkinter_sujet5.py

@ -6,12 +6,12 @@ def spawn_rectangle() :
indice_couleur = randint(0, len(lst)-1) indice_couleur = randint(0, len(lst)-1)
couleur = lst[indice_couleur] couleur = lst[indice_couleur]
taille = randint(10, 30) taille = randint(10, 30)
position_x = randint(0, 400) position_x = randint(0, 390)
position_y = randint(0, 300) position_y = randint(0, 290)
if position_x+taille > 400 : if position_x+taille > 400 :
position_x = position_x-taille taille = randint(10, 400-position_x)
if position_y+taille > 300 : if position_y+taille > 300 :
position_y = position_y-taille taille = randint(10, 300-position_y)
rectangle = canva.create_rectangle(position_x, position_y, position_x+taille, rectangle = canva.create_rectangle(position_x, position_y, position_x+taille,
position_y+taille, fill = couleur) position_y+taille, fill = couleur)

Loading…
Cancel
Save