Jun-15-2020, 02:32 PM
I need help figuring out my code as it is not running after this part (Line 49), where it shows, "Welcome..." any thoughts??
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 |
t = 0 #Authentication Page from tkinter import * import tkinter.messagebox as tm class LoginFrame(Frame): def __init__( self , master): super ().__init__(master) print ( "Welcome to the Weather Engine. Please enter your seven digit Forecaster ID Number followed by your password." ) self .label_username = Label( self , text = "Forecaster ID" ) self .label_password = Label( self , text = "Password" ) self .entry_username = Entry( self ) self .entry_password = Entry( self , show = "X" ) self .label_username.grid(row = 0 , sticky = E) self .label_password.grid(row = 1 , sticky = E) self .entry_username.grid(row = 0 , column = 1 ) self .entry_password.grid(row = 1 , column = 1 ) self .checkbox = Checkbutton( self , text = "Remember Me" ) self .checkbox.grid(columnspan = 2 ) self .logbtn = Button( self , text = "Login" , command = self ._login_btn_clicked) self .logbtn.grid(columnspan = 2 ) self .pack() def _login_btn_clicked( self ): # print("Clicked") username = self .entry_username.get() password = self .entry_password.get() # print(username, password) if username = = "12141" and password = = "7777" : tm.showinfo( "Login info" , "Welcome Admin" ) forecaster = "Admin" t = 1 if username = = "25101" and password = = "12345" : tm.showinfo( "Login info" , "Welcome User1" ) t = 2 root = Tk() lf = LoginFrame(root) root.mainloop() if t ! = str ( 0 ): print ( "Hello " + forecaster + ", What do you want to do?" ) |
Output:"Welcome Forecaster"
Thank you in advance 