From 1d03ecddc6cadf9fb86ca402f85dac79a4c66588 Mon Sep 17 00:00:00 2001 From: ROBINET Julien Date: Thu, 26 Mar 2026 19:56:13 +0100 Subject: [PATCH] =?UTF-8?q?deuxi=C3=A8me=20tentative=20de=20la=20fonction?= =?UTF-8?q?=20spawn=5Frectangle=20mais=20rat=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- projet_tkinter_sujet5.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/projet_tkinter_sujet5.py b/projet_tkinter_sujet5.py index a55480d..29a1dc9 100644 --- a/projet_tkinter_sujet5.py +++ b/projet_tkinter_sujet5.py @@ -14,15 +14,22 @@ if indice_couleur == 3 : if indice_couleur == 4 : couleur = "grey" -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) +#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)# 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, position_y+taille, fill = couleur)