Reputation: 83
I am trying to create a program using guizero i want a application window to appear which allows the user to enter their username and password and select whethe they are a student or a techer. I then want it to open a different window whether they are student or a teacher?
I have so far created this? But its not working properly? Any ideas?
from guizero import App, Text, TextBox, ButtonGroup, PushButton
def displayaccounttype(accounttype):
checkaccounttype.value=accounttype.value
def login_screen():
login=App(title="This is a login screen", width=500, height=500, layout="grid")
username_label=Text(login, text="Please enter your username:", grid=[0,0], align="left")
username_input=TextBox(login, width=20, grid=[1,0], align="left")
password_label=Text(login, text="Please enter your password:", grid=[0,1], align="left")
password_input=TextBox(login, width=20, grid=[1,1], align="left")
accounttype_label=Text(login, text="Select an account type: ", grid=[0,2])
accounttype=ButtonGroup(login, options=[ ["Student", "S"],["Teacher", "T"]], selected="S", horizontal=True, grid=[1,2], align="left")
login_btn=PushButton(login, text="Login", command=displayaccounttype(accounttype), grid=[0,3], align="left")
checkaccounttype=Text(login, grid=[0,4], align="left")
login.display()
return accounttype
login_screen()
Upvotes: 0
Views: 28