【发布时间】:2013-07-08 22:45:20
【问题描述】:
假设我有一个选项菜单 network_select,其中包含要连接的网络列表。
import Tkinter as tk
choices = ('network one', 'network two', 'network three')
var = tk.StringVar(root)
network_select = tk.OptionMenu(root, var, *choices)
现在,当用户按下刷新按钮时,我想更新用户可以连接的网络列表。
- 我不能使用
.config,因为我查看了network_select.config()并没有看到一个看起来像我给它的选项的条目。 - 我不认为这是可以使用 tk 变量来改变的,因为没有
ListVar这样的东西。
【问题讨论】:
-
让它成为对象变量怎么样?
标签: python python-2.7 tkinter onclick optionmenu