使用 tix、Tkinter 从 ComboBox 获取值

Get value from a ComboBox using tix, Tkinter

我使用 Tkinter 包生成了我的 GUI。它有一些我用这些命令创建的条目

self.tent = Entry(self.side_options_frame)
self.tent.pack(padx=5, pady=6)

然后,我决定添加 ComboBox,我不想使用 ttk 包,所以我用这些命令创建了 ComboBox

from Tix import Tk, Control, ComboBox

self.tent = ComboBox(self.side_options_frame, label='    ',editable = True)
for temp in ('sim_trainer', 'sim_trainer:49916'):
    self.tent.insert(END,temp)
self.tent.pack(padx=5, pady=6)

问题是,之前我可以使用 "self.tent.get()" 获取条目,但现在我收到错误:

Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Python27\lib\lib-tk\Tkinter.py", line 1470, in __call__
    return self.func(*args)
  File "C:\Users\Administrator\PycharmProjects\SSPFAT\SSPANIMATE\XMLGEN.py", line 318, in cancelButtonClick
    self.inputset = [self.pipent.get(),self.hosent.get(),self.tent.get(),self.lent.get(),self.pent.get()]
  File "C:\Python27\lib\lib-tk\Tix.py", line 341, in __getattr__
    raise AttributeError, name
AttributeError: get

你能告诉我如何从我的组合框中获取条目吗?

使用self.tent['selection']代替self.tent.get()