You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
437 B

import tkinter as tk
from random import randint
lst = ["red", "green", "blue", "yellow", "grey"]
indice_couleur = randint(0, len(lst))
taille = randint(10, 31)
position_x = randint(0, 401)
position_y = randint(0, 301)
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)
fenetre.mainloop()