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 29 30 31 32 33 34 35 36 37
| from tkinter import*
fenetre = Tk ()
fenetre.title("Gestion ouverture")
#Fenetre ouvrant une image de cadenas fermée
def PHOTOOUVERTE():
Fenetre=Tk()
photo1=PhotoImage(file="cadenas.gif",format="gif -index 1")
labl = Label(Fenetre, image=photo)
labl.pack()
Fenetre.mainloop()
def PHOTOFERMEE():
Fenetre=Tk()
photo=PhotoImage(file="cadenas.gif",format="gif -index 1")
labl = Label(Fenetre, image=photo)
labl.pack()
Fenetre.mainloop()
#_____________________ MESSAGE __________________________
msg1= Label(fenetre, text ="Deverrouiller la boite aux lettres ?", font = "arial 16 bold", fg = "blue").grid(row = 0, columnspan = 2)
#__________________ BOUTONS __________________
bouton_yes = Button(fenetre, text =" OUI ",command = PHOTOOUVERTE, fg="green").grid(row=4, column=0)
bouton_no = Button(fenetre, text=" NON ",command= PHOTOFERMEE, fg = "red").grid(row=4, column=1)
#________________________ Image ___________________
photo = PhotoImage(file ='cadenas.gif')
espace_image = Canvas(fenetre, width =170, height =170, bg ='blue')
espace_image.grid(row=3 ,columnspan=2, column=0, padx =10, pady =10)
espace_image.create_image(85, 85, image =photo)
mainloop () |
Partager