在下面所示的简单代码中,我有两个OptionMenu小部件:
variable = StringVar(win1)
variable.set(number(number2))
type = OptionMenu(win1, variable, "None", "Clear", "Dark", "Heavy", )
type.grid(row=i, column=3, sticky="nsew", padx=1, pady=1)
variableunit = StringVar(win1)
variableunit.set(unit)
unit = OptionMenu(win1, variableunit, "colour", "shade")
unit.grid(row=i, column=5, sticky="nsew", padx=1, pady=1)
我尝试过用回调函数跟踪,但到目前为止还没有成功。我想链接当“重”是在第一个菜单,第二个菜单总是“颜色”。对于其余选项,第二个菜单必须始终是默认的“着色”,但可以更改。在
如果有人能帮助我,我将不胜感激。我已经看了efffbot网站的变量和痕迹,但仍然卡住。在
你想要什么还不太清楚,但我认为这应该可以。在
当在第一个菜单中选择“重”时,在第二个菜单中选择“颜色”,并且该菜单被禁用(不能选择其他任何内容)。当在第一个菜单中选择其他内容时,第二个菜单将转到“mm”并再次启用。在
相关问题 更多 >
编程相关推荐