我一直在四处搜索,但在Tkinter中找不到OptionMenu语法的正确解释。你知道吗
如何在OptionMenu中获得当前选中的选项?你知道吗
def homeTeamOption(self, frame, sortedList):
def func():
print(homeTeamName)
return
homeTeam = tk.StringVar(frame)
returnValueAwayTeam = []
options = sortedList
homeTeamName = tk.StringVar()
drop = OptionMenu(frame, homeTeamName, *options, command=func())
drop.place(x=200, y= 100, anchor="nw")
要获取
OptionMenu
的值,需要获取关联变量的值。在您的情况下:如果要通过
command
执行此操作,必须将选项设置为对函数的引用:相关问题 更多 >
编程相关推荐