2011-12-15 26 views
0

私が持っているのpython 2.7.2-4(Archlinux)、およびtk.StringVar()Tkinter.StringVar()が例外をスローし

import Tkinter 
Tkinter.StringVar() 

結果

Traceback (most recent call last): 
    File "/tmp/foo.py", line 3, in <module> 
    foo = Tkinter.StringVar() 
    File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 251, in __init__ 
    Variable.__init__(self, master, value, name) 
    File "/usr/lib/python2.7/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 0x1815710>> ignored 

答えて

1

コールtk.Tk()から:

import Tkinter as tk 

root=tk.Tk()  
tk.StringVar() 
関連する問題