Browse Source

deuxième tentative de la fonction spawn_rectangle mais ratée

master
ROBINET Julien 4 weeks ago
parent
commit
1d03ecddc6
  1. 21
      projet_tkinter_sujet5.py

21
projet_tkinter_sujet5.py

@ -14,15 +14,22 @@ if indice_couleur == 3 :
if indice_couleur == 4 : if indice_couleur == 4 :
couleur = "grey" couleur = "grey"
taille = randint(10, 30) #taille = randint(10, 30)#
position_x = randint(0, 400) #position_x = randint(0, 400)#
position_y = randint(0, 300) #position_y = randint(0, 300)#
while position_x+taille > 400 or position_y+taille > 300: #while position_x+taille > 400 or position_y+taille > 300:#
taille = randint(10, 31) # taille = randint(10, 31)#
position_x = randint(0, 400) # position_x = randint(0, 400)#
position_y = randint(0, 300) # position_y = randint(0, 300)#
def spawn_rectangle() : def spawn_rectangle() :
taille = randint(10, 30)
position_x = randint(0, 400)
position_y = randint(0, 300)
while position_x+taille > 400 or position_y+taille > 300:
taille = randint(10, 31)
position_x = randint(0, 400)
position_y = randint(0, 300)
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