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
| from Tkinter import *
root=Tk()
root.update()
root.eval('tk::PlaceWindow %s center' % root.winfo_pathname(root.winfo_id()))
root.resizable(width=False, height=False)
root.title("Authentification")
def Verification(**retour):
if Motdepasse.get() == 'password':
# le mot de passe est bon :
tkMessageBox.showwarning('Resultat','Authentification reussi !')
command=go()
else:
# --le mot de passe est incorrect--
tkMessageBox.showwarning('Erreur','Mot de passe incorrect.\nVeuillez recommencer !')
Motdepasse.set('')
return retour
# Creation d'un Label avec texte 'Mot de passe'
authmdp = Label(root, text = 'Mot de passe ')
authmdp.pack(side = LEFT, padx = 5, pady = 5)
#--Centre la fenetre a l ecran--
# Creation d'un champ de saisie
Motdepasse= StringVar()
Champ = Entry(root, textvariable= Motdepasse, show='*', bg ='bisque', fg='black')
Champ.focus_set()
Champ.pack(side = LEFT, padx = 5, pady = 5)
# Creation bouton Valider
Bouton = Button(root, text ='Valider', command = Verification)
Bouton.pack(side = LEFT, padx = 5, pady = 5)
# Creation bouton quitter
Bouton = Button(root, text ='quitter',width=12,height=2,command=root.destroy, bg ='red', fg='white')
Bouton.pack(side = LEFT, padx = 6, pady = 6)
root.mainloop() |
Partager