我easygui.multchoicebox()
用来选择一个元组中的多个项目。How do I make a conditional that executes code when certain items from the tuple are selected?
这是不起作用的示例代码(不返回任何内容):
from easygui import *
fieldnames = ["Yes", "No", "Maybe"]
choice = multchoicebox("Pick an option.", "", fieldnames)
if choice == fieldnames[0,1]:
msgbox('Incomplete')
if choice == fieldnames[2]:
msgbox('Complete')
它说列表索引不能是元组。我将条件更改为字符串,但它也不起作用(仍然没有返回):
from easygui import *
fieldnames = ["Yes", "No", "Maybe"]
choice = multchoicebox("Pick an option.", "", fieldnames)
if choice == "Yes" and "No":
msgbox('Incomplete')
if choice == "Maybe":
msgbox('Complete')
是什么阻止了代码被执行?如果easygui.multchoicebox()
不是由此设计的,那是什么模块?