1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| from tkinter import *
import time
class feux:
#def __init__(self, nom_can, pos_x, pos_y, taille_x, taille_y):
# nom_can.create_oval(pos_x, pos_y, pos_x + taille_x, pos_y + taille_y, width=2, fill='grey')
def __init__(self, nom_can):
nom_can.create_oval(30, 30, 60, 60, width=2, fill='grey')
def allume_rouge(self, nom_can):
nom_can.itemconfigure(self, fill='red')
window = Tk()
window.title("Feux de départ")
window.geometry("480x360")
window.config(background="#41B77F")
can1 = Canvas(window,bg='dark grey',height=330, width=400)
can1.pack(expand="YES")
#feux1 = can1.create_oval(30, 30, 60, 60, width=2, fill='grey')
feux1 = feux(can1)
#can1.itemconfigure(feux1, fill='red')
#feux1.allume_rouge(can1)
window.mainloop() |
Partager