我是python的新手,当我撞墙时,我正在制作一个带有'easygui'的小程序。我想得到一个名为“Back”的按钮带我回到前一行,但我不知道如何。我在网上搜索并发现了while循环,但我无法想出如何把它放进去。感谢任何评论。
from easygui import *
msg = "Enter Login Information";
title = "";
fieldNames = ["Username", "Password"];
fieldValues = [];
fieldValues = multpasswordbox(msg,title,fieldNames);
USERNAME, PASSWORD = fieldValues[0], fieldValues[1];
if USERNAME == "username" and PASSWORD == "password":
#This is where i would like the button to take me
msg = "What would you like to do?"
title = "Options"
choices=['passwords','usernames','other','close']
choice=buttonbox(msg, title,choices)
if choice=='passwords':
msg = "Here is the info you requested"
title = "Passwords"
choices=['Back']
choice=buttonbox(msg, title,choices)
if choice=='Back': #this is the button
elif choice=='usernames':
msgbox("Here is the info you requested")
elif choice=='other':
msgbox("Here is the info you requested")
else:
msgbox("Access Denied");