Reputation: 15
I have written some GUI with python using appJar. I am trying to start the application with the login Subwindow. However when I run the code I get the error "AttributeError: enter" Hopefully someone can let me know what I am doing wrong. This is my first time using GUI.
Full Error Message: 2018-05-01 15:24:38,521 appJar:ERROR [Line 40->1630/exit]: ContextManager failed: enter Traceback (most recent call last): File "C:/Users/Jason Smit/PycharmProjects/Project-X/main.py", line 17, in with app.startSubWindow("Sub1", "LogWin",): AttributeError: enter
def login(btn):
if btn == "Unlock":
app.infoBox("Success", "Access granted\n Welcome User")
app.hideSubWindow("Sub1")
return
###################
# GUI starts here #
###################
with gui("Project-X") as app:
app.setBg("white")
app.setIcon("app_icon.ico") # App icon
with app.startSubWindow("Sub1", "LogWin",):
# Empty left container (To help get login in center.)
with app.frame("LEFT", row=0, column=0, sticky='NEW', stretch='COLUMN'):
""""""
# Login container/gui
with app.frame("CenterTop", row=0, column=1, sticky='NEW', stretch='column'):
app.setBg("white")
with app.labelFrame("Login"):
app.setBg("white")
app.setSticky("ew")
# Login widget setup
app.addLabel("l1", "Name", 0, 0)
app.addEntry("Name", 0, 1)
app.addLabel("l2", "Password", 1, 0)
app.addSecretEntry("Password", 1, 1)
app.addNamedButton("Submit", "Unlock", login, 2, 0, 2)
# Empty right container (To help get login in center.)
with app.frame("RIGHT", row=0, column=2, sticky='NEW', stretch='COLUMN'):
""""""
app.stopSubWindow()
app.go(startWindow="Sub1")
Upvotes: 0
Views: 119
Reputation: 281252
The context manager is subWindow
, not startSubWindow
:
with app.subWindow("Sub1", "LogWin"):
Upvotes: 1