Есть ли способ перейти на конкретную строку в 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");

0 ответов

Другие вопросы по тегам