File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import tkinter as tk
22from tkinter import messagebox
33
4+
45def check_password (password ):
56 with open ("pwd.txt" , "r" ) as file :
67 common_passwords = file .read ().splitlines ()
78
89 for i , common_pwd in enumerate (common_passwords , start = 1 ):
910 if password == common_pwd :
10- messagebox .showinfo ("Password Check" , f"{ password } : not unique (#{ i } )" )
11+ messagebox .showinfo (
12+ "Password Check" , f"{ password } : not unique (#{ i } )" )
1113 return
1214
1315 messagebox .showinfo ("Password Check" , f"{ password } : unique" )
1416
17+
1518def main ():
1619 app = tk .Tk ()
1720 app .title ("Password Checker" )
@@ -23,10 +26,12 @@ def main():
2326 password_entry = tk .Entry (app , show = "*" )
2427 password_entry .pack ()
2528
26- check_button = tk .Button (app , text = "Check" , command = lambda : check_password (password_entry .get ()))
29+ check_button = tk .Button (
30+ app , text = "Check" , command = lambda : check_password (password_entry .get ()))
2731 check_button .pack ()
2832
2933 app .mainloop ()
3034
35+
3136if __name__ == "__main__" :
3237 main ()
You can’t perform that action at this time.
0 commit comments