如何在弹出文本输出中显示函数的结果
import PySimpleGUI as sg
FILMS = [["There will be blood", "Paul Thomas Anderson", 2007],
["Lion King","Rob Minkoff", 1994],
["Toy Story","Josh Cooley",1995],
["Monty Python's Life of Brian","Terry Jones",1979],
["Die Hard","John McTiernan",1988],
["Rocky","John G. Avildsen",1976]]
def listprint():
for i in range (len(FILMS)):
print(FILMS[i][0])
event, values = sg.Window('Find a film', [[sg.Text('Are you ready:')],[sg.B("OK",key="-OK-"), sg.B("Return",key="-Return-")] ]).read(close=True)
if event == '-OK-':
sg.popup('Film names will be printed in the python output:',command = listprint)
只需将结果传递给
sg.popup
,但使用*
解压列表/元组。有时,它看起来不太好,您可以使用用户定义的弹出窗口来显示它们相关问题 更多 >
编程相关推荐