<p>这里我需要装箱一个<code>DropDown</code>类,然后将其添加到<code>root</code>或{<cd3>}GUI中。但是<code>Tkinter.StringVar()</code>抛出一个错误</p>
<pre><code>`Traceback (most recent call last):
File "D:/Testing/Tiks/main2.py", line 64, in <module>
d = Droppy(application)
File "D:/Testing/Tiks/main2.py", line 45, in __init__
self.control_variable = Tkinter.StringVar()
File "C:\Python26\lib\lib-tk\Tkinter.py", line 251, in __init__
Variable.__init__(self, master, value, name)
File "C:\Python26\lib\lib-tk\Tkinter.py", line 182, in __init__
self._tk = master.tk
AttributeError: 'NoneType' object has no attribute 'tk'
Exception AttributeError: "StringVar instance has no attribute '_tk'" in <bound method StringVar.__del__ of <Tkinter.StringVar instance at 0x0236F7B0>> ignored`
</code></pre>
<p>我的代码是这样的</p>
^{pr2}$
<p>现在我知道在<code>Tkinter.StringVar()</code>之前<code>Tkinter.Tk()</code>可以解决这个问题,但是我不能把<code>Tkinter.Tk()</code>和特金特·斯特林瓦尔在同一个班里。我怎样才能避免这个问题?谁能帮忙吗</p>