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 67 68 69 70 71 72 73 74 75
| from Tkinter import *
import os
import Tkinter
import tkMessageBox
#Tkinter.NoDefaultRoot()
root=Tk()
root.iconbitmap("rasp.xpm")
root.update()
root.eval('tk::PlaceWindow %s center' % root.winfo_pathname(root.winfo_id()))
root.resizable(width=False, height=False)
root.title("Authentification")
#--Verification du mot de passe--
def Verification(**retour):
if Motdepasse.get() == 'mdp':
# le mot de passe est bon : on affiche une boite de dialogue puis on ferme la fenetre
command=menugepex()
go=Button(root, text="Auth_reussi", command=progssh)
tkMessageBox.showinfo('Resultat','Mot de passe correct.\nA vous de jouer !')
go.pack(side = LEFT, padx = 5, pady = 5)
root.destroy()
quit()
else:
# --le mot de passe est incorrect--
tkMessageBox.showwarning('Resultat','Mot de passe incorrect.\nVeuillez recommencer !')
Motdepasse.set('')
return retour
# Creation d'un Label avec texte 'Mot de passe'
#-----------------------------------------------------------
#authmdp = LabelFrame(root, text="Authentification")
#-----------------------------------------------------------
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)
def menugepex():
menubar = Menu(root)
filemenu = Menu(menubar, tearoff=0, bg='black', fg='white', activebackground='red', activeforeground='yellow')
quitmenu = Menu(menubar, tearoff=0)
menubar.add_cascade(label="Quitter", command=root.destroy)
root.config(menu=menubar)
root.config(width=600, height=600)
root.mainloop()
#fermeture de la boucle
root.mainloop()
os.system("taskkill /f /im module_v1.exe"); |
Partager