()
| 29 | entry_usr_pwd.place(x=160, y=190) |
| 30 | |
| 31 | def usr_login(): |
| 32 | usr_name = var_usr_name.get() |
| 33 | usr_pwd = var_usr_pwd.get() |
| 34 | try: |
| 35 | with open('usrs_info.pickle', 'rb') as usr_file: |
| 36 | usrs_info = pickle.load(usr_file) |
| 37 | except FileNotFoundError: |
| 38 | with open('usrs_info.pickle', 'wb') as usr_file: |
| 39 | usrs_info = {'admin': 'admin'} |
| 40 | pickle.dump(usrs_info, usr_file) |
| 41 | if usr_name in usrs_info: |
| 42 | if usr_pwd == usrs_info[usr_name]: |
| 43 | tk.messagebox.showinfo(title='Welcome', message='How are you? ' + usr_name) |
| 44 | else: |
| 45 | tk.messagebox.showerror(message='Error, your password is wrong, try again.') |
| 46 | else: |
| 47 | is_sign_up = tk.messagebox.askyesno('Welcome', |
| 48 | 'You have not sign up yet. Sign up today?') |
| 49 | if is_sign_up: |
| 50 | usr_sign_up() |
| 51 | |
| 52 | def usr_sign_up(): |
| 53 | pass |
nothing calls this directly
no test coverage detected