在python中,有没有一种方法可以到达特定的行?

2024-09-22 20:29:44 发布

您现在位置:Python中文网/ 问答频道 /正文

我是python的新手,当我碰到一堵墙的时候,我正在用easygui做一个小程序。我想按一下“后退”按钮,让我回到上一行,但我不知道该怎么做。我在网上搜索了一下,找到了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");

Tags: theinfoyouifheretitleismsg