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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
from tkinter import *
from tkinter.messagebox import * # boîte de dialogue
#FONCTION MOT DE PASSE QUAND ON CLIQUE SUR OUVRIR LA BOITE AUX LETTRES
#_______________________________________________________________________
def MOTDEPASSE9():
def Verification():
if motdepasse.get == 'ISN':
# le mot de passe est bon : on affiche une boîte de dialogue puis on ouvre la fenêtre ouverture
showinfo('Résultat','Mot de passe correct.\n')
fenetremdp.destroy()
else:
# le mot de passe est incorrect : on affiche une boîte de dialogue
showwarning('Résultat','Mot de passe incorrect.\nVeuillez recommencer !')
Motdepasse.set('')
# Création de la fenêtre principale
fenetremdp = Tk()
fenetremdp.title('Identification requise')
# Création d'un widget Label (texte 'Mot de passe')
Label1 = Label(fenetremdp, text = 'Mot de passe ')
Label1.pack(side = LEFT, padx = 5, pady = 5)
# Création d'un widget Entry (champ de saisie)
Motdepasse= StringVar()
Champ = Entry(fenetremdp, textvariable= Motdepasse, show='*', bg ='bisque', fg='maroon')
Champ.focus_set()
Champ.pack(side = LEFT, padx = 5, pady = 5)
SNMDP=Motdepasse.get()
# Création d'un widget Button (bouton Valider)
Bouton = Button(fenetremdp, text ='Valider', command = Verification)
Bouton.pack(side = LEFT, padx = 5, pady = 5)
fenetremdp.mainloop
#____________________PROGRAMME PRINCIPAL__________________________________________________
#Création de la fenetre principale
fenetreprincipale=Tk()
fenetreprincipale.geometry('600x300')
fenetreprincipale.title("Interface principal")
# Création d'un widget Button (bouton Ouvrir la boite aux lettres)
Bouton = Button(fenetreprincipale, text ='Ouvrir la boite aux lettres à distance',command = MOTDEPASSE9)
Bouton.config( height = 10, width = 20 )
Bouton.pack(fill = BOTH)
# Création d'un widget Button (bouton Verification Boite aux lettres)
Bouton1 = Button(fenetreprincipale, text ='Verification Boite aux lettres',command = RAPPEL)
Bouton1.config( height = 20, width = 20 )
Bouton1.pack(fill=BOTH)
fenetreprincipale.mainloop() |
Partager