当用户选择一个选项时,我想从combobox小部件中删除高亮显示。但是select\u clear()方法似乎不起作用:(
有什么线索吗?
from tkinter import *
from tkinter.ttk import Combobox
class hey(Frame):
def __init__(self):
Frame.__init__(self)
self.comboboxVariable = StringVar()
values = (1, 2, 3, 4, 5)
self.comboBox = Combobox(self, textvariable = self.comboboxVariable, values = values, state = 'readonly')
self.comboBox.pack()
self.comboBox.bind("<<ComboboxSelected>>", self.updateData)
def updateData(self, event =None):
self.comboBox.select_clear()
myClass = hey()
myClass.pack()
root = myClass.master
root.mainloop()
目前没有回答
相关问题 更多 >
编程相关推荐