|
|
|
@ -22,12 +22,18 @@ while position_x+taille > 400 or position_y+taille > 300: |
|
|
|
position_x = randint(0, 400) |
|
|
|
position_y = randint(0, 300) |
|
|
|
|
|
|
|
def spawn_rectangle() : |
|
|
|
rectangle = canva.create_rectangle(position_x, position_y, position_x+taille, |
|
|
|
position_y+taille, fill = couleur) |
|
|
|
|
|
|
|
fenetre = tk.Tk() |
|
|
|
|
|
|
|
canva = tk.Canvas(fenetre, width = 400, height = 300, bg = "white") |
|
|
|
canva.grid() |
|
|
|
|
|
|
|
rectangle = canva.create_rectangle(position_x, position_y, position_x+taille, |
|
|
|
position_y+taille, fill = couleur) |
|
|
|
Dessin = tk.Button(fenetre, text = "Dessine").grid() |
|
|
|
#rectangle = canva.create_rectangle(position_x, position_y, position_x+taille,# |
|
|
|
# position_y+taille, fill = couleur)# |
|
|
|
|
|
|
|
Dessin = tk.Button(fenetre, text = "Dessine", command = "spawn_rectangle").grid() |
|
|
|
|
|
|
|
fenetre.mainloop() |