我想在以下方面寻求帮助。在
我正在做一个小项目,它需要根据用户在选项菜单中所做的选择来更新组合框值。在
当前,组合框显示线程1的值,但在大多数情况下,它显示的值类似于带有数字的PY(即PY_VAR2)
下面是我尝试连接的这两个小部件的代码的主要部分。在
提前谢谢你的帮助。在
### Option Menu Section
thdTypeLabel = Label(thdParamsFrame, text="Thread Type")
thdTypeLabel.grid(row=0, column=0, padx=(30,10), pady=(10,10),sticky=E)
thdInitType = StringVar(thdParamsFrame)
thdInitType.set("Thread 1")
thdTypeMenu = OptionMenu(thdParamsFrame, thdInitType, "Thread 1","Thread 2", "Thread 3", command=thdTypeSelection)
thdTypeMenu.grid(row=0, column=1)
thdTypeMenu.configure(width=14)
组合框部分
^{pr2}$
好吧,您有一个来自OptionMenu的回调:
thdTypeSelection
所以只需在那里更新组合框:让我有点困扰的是
Thread 1
已经在选项菜单中被选中了,但是组合框显示了TPIVals
,不管它们是什么。在相关问题 更多 >
编程相关推荐