Hi all, I currently have some code:
import time import Tkinter as tk root = tk.Tk() pass_entered= False def show_pw(): pw = pw_entry.get() if pw == "password": label2['text'] = pw pass_entered==True return pass_entered else: label2['text'] = "Sorry, wrong pass" def logoff(mins): lbl1.config(height=3, font=('times', 20, 'bold')) for k in range(int(mins), 0, -1): lbl1["text"] = str(k)+' Minutes remaining' root.update() time.sleep(5) print k if pass_entered == True: break lbl1["text"] = "Now logging off" ctypes.windll.user32.LockWorkStation() pw_entry = tk.Entry(root, show="*") pw_entry.focus() button = tk.Button(root, text='override', command=show_pw) label2 = tk.Label(root) label1.pack() pw_entry.pack() button.pack() label2.pack() lbl1=tk.Label() lbl1.pack() logoff(100) root.mainloop()
and Im trying to stop the logoff loop once the right password is enetered, but I cant seem to stop it. Can anyone help with either a fix to my current code or a different method that works?
Thanks in advance