diff --git a/projet_tkinter_sujet5.py b/projet_tkinter_sujet5.py index 6d7c334..45d5a0e 100644 --- a/projet_tkinter_sujet5.py +++ b/projet_tkinter_sujet5.py @@ -2,18 +2,9 @@ import tkinter as tk from random import randint def spawn_rectangle() : - indice_couleur = randint(0, 4) - couleur = 0 - if indice_couleur == 0 : - couleur = "red" - if indice_couleur == 1 : - couleur = "green" - if indice_couleur == 2 : - couleur = "blue" - if indice_couleur == 3 : - couleur = "yellow" - if indice_couleur == 4 : - couleur = "grey" + lst = ["red", "blue", "green", "yellow", "grey"] + indice_couleur = randint(0, len(lst)-1) + couleur = lst[indice_couleur] taille = randint(10, 30) position_x = randint(0, 400) position_y = randint(0, 300)