1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
   | class Tout(Frame):
    def __init__(self):
        Frame.__init__(self)
        self.x = 302
        self.y = 435
        self.c = Canvas(self, height=440, width=600, bg="light yellow")
        self.photo = PhotoImage(file ='lab3.gif')
        self.img = self.c.create_image(300, 220, image = self.photo)
        self.im = Image.open('lab3.GIF')
        self.c.pack()
        self. l = self.c.create_rectangle(self.x, self.y, self.x+20, self.y+20)
        self.bind('<Left>', lambda arg='gauche': self.deplace(arg))
        self.bind('<Right>', lambda arg='droite': self.deplace(arg)) 
        self.bind('<Up>', lambda arg='haut': self.deplace(arg)) 
        self.bind('<Down>', lambda arg='bas': self.deplace(arg)) 
        b_fin = Button(self, text ='Terminer', bg ='royal blue', fg ='white', font =('Helvetica', 10, 'bold'), command =self.quit)
        b_fin.pack()
        self.pack() | 
Partager