codice:
#Apertura file necessari
User1File=file(r"User1File.txt","r")
User2File=file(r"User2File.txt","r")
User3File=file(r"User3File.txt","r")
#Assegnazioni delle variabili
DatiUser1=pickle.load(User1File)
DatiUser2=pickle.load(User2File)
DatiUser3=pickle.load(User3File)
AccauntControl=3
Null=" "
#Chiusura file
User1File.close()
User2File.close()
User3File.close()
#Controllo disponibilità accaunt
if DatiUser1[0] == Null:
AccauntControl=AccauntControl-3
else:
if DatiUser2[0] == Null:
AccauntControl=AccauntControl-2
else:
if DatiUser3[0] == Null:
AccauntControl=AccauntControl-1
#Creazione Finestra Padre
RegisterWindow=Tk()
RegisterWindow.title("Registra un nuovo accaunt")
RegisterWindow.resizable(True,True)
RegisterWindow['background']="White"
#Negazione
if AccauntControl == 3:
Label=Label(RegisterWindow, text="Non puoi registrare altri accaunt perchè in questo computer perchè ce ne sono già 3.", bg="Whithe", fg="Black").grid(row=2,column=0)
Chiudi=Button(text="Chiudi",command=ChiudiRegisterWindow).grid(row=2,column=1)
#Creazione interfaccia di registrazione
else:
while True:
Name=StringVar()
Label=Label(RegisterWindow, text="Nome", bg="White", fg="Black").grid(row=2,column=0)
NameGet=Entry(RegisterWindow, textvariable=Name,width=30).grid(row=2,column=1)
SurName=StringVar()
SurnameLabel=Label(RegisterWindow, text="Cognome", bg="White", fg="Black").grid(row=2,column=3)
SurnameGet=Entry(RegisterWindow, textvariable=Surname,width=30).grid(row=2,column=4)
User=StringVar()
UserLabel=Label(RegisterWindow, text="UserName", bg="White", fg="Black").grid(row=3,column=0)
UserGet=Entry(RegisterWindow, textvariable=User,width=30).grid(row=3,column=1)
Pass1=StringVar()
PasswordLabel=Label(RegisterWindow, text="Password", bg="White", fg="Black").grid(row=4,column=0)
Pass2=StringVar()
PasswordLabel=Label(RegisterWindow, text="Conferma Password", bg="White", fg="Black").grid(row=4,column=3)
PasswordGet=Entry(RegisterWindow, textvariable=Pass2,width=30).grid(row=4,column=4)
ContinuaRegistrazioneButton=Button(text="Continua",command=ContinuaRegistrazione2).grid(row=8,column=4)
InfoLabel=Label(RegisterWindow, text="I dati personali inseriti sono destinati soltanto all'utilizzo all'interno del computer. Essi non verranno trasmessi a nessun altro dispositivo.", bg="White", fg="Black").grid(row=7,column=0)
AnnullaButton=Button(text="Annulla",command=ChiudiRegisterWindow).grid(row=8,column=0)
if AccauntControl == 0:
User1File=file(r"User1File.txt","w")
PassHash=hashlib.sha224()
PassHash.update(Pass1)
PassHashed=PassHash.hexdigest()
UserList=[User,Name,SurName,PassHashed]
pickle.dump(UserList, User1File)
User1File.close()
elif AccauntControl == 1:
User2File=file(r"User2File.txt","w")
PassHash=hashlib.sha224()
PassHash.update(Pass1)
PassHashed=PassHash.hexdigest()
UserList=[User,Name,SurName,PassHashed]
pickle.dump(UserList, User2File)
User2File.close()
elif AccauntControl == 2:
User3File=file(r"User3File.txt","w")
PassHash=hashlib.sha224()
PassHash.update(Pass1)
PassHashed=PassHash.hexdigest()
UserList=[User,Name,SurName,PassHashed]
pickle.dump(UserList, User3File)
User3File.close()
#Creazione interfaccia finale
tkMessageBox.showinfo("Registrazione Completata!", "Ora puoi effettuare il login!")
Chiudi=Button(text="Chiudi",command=ChiudiRegisterWindowFinal).grid(row=2,column=1)
#Comando di sistema
RegisterWindow.mainloop()
non è ancora completo ma appena provo solo l'interfaccia mi da l'errore...