小编Nic*_*ick的帖子

将值附加到 TTK Combobox['values'] 而不重新加载组合框

我需要将值添加到 ttk.combobox 而不重新加载整个内容。向 GUI 添加值时,不应重新加载 GUI 上的当前选择。

我需要这样的东西:

for string in listofstrings:
    if string not in self.combobox1['values']:
        self.combobox1['values'].append(string)
Run Code Online (Sandbox Code Playgroud)

当我像这样尝试时,出现此错误:

AttributeError: 'tuple' 对象没有属性 'append'

(正如预期的那样)。

在此先感谢您的帮助。

python tkinter ttk python-3.x

2
推荐指数
1
解决办法
5895
查看次数

标签 统计

python ×1

python-3.x ×1

tkinter ×1

ttk ×1