Browse Source

obtimisation fonction spawn_rectangle

master
ROBINET Julien 4 weeks ago
parent
commit
d7221b71ff
  1. 15
      projet_tkinter_sujet5.py

15
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)

Loading…
Cancel
Save