Sunday, 15 May 2011

python - Tkinter error with importing -



python - Tkinter error with importing -

i'm trying create simple gui programme in python when seek run error:

this have in code.

from tkinter import * test = tk() test.title("reverse") test.geometry("300 x 200") test.mainloop() 'import site' failed; utilize -v traceback traceback (most recent phone call last): file "c:/users/brenda/pycharmprojects/reverse string/reverse string.py", line 1, in <module> tkinter import * file "c:\python27\lib\lib-tk\tkinter.py", line 38, in <module> import fixtk file "c:\python27\lib\lib-tk\fixtk.py", line 1, in <module> import sys, os file "c:\python27\lib\os.py", line 398, in <module> import userdict file "c:\python27\lib\userdict.py", line 84, in <module> _abcoll.mutablemapping.register(iterableuserdict) file "c:\python27\lib\abc.py", line 109, in register if issubclass(subclass, cls): file "c:\python27\lib\abc.py", line 184, in __subclasscheck__ cls._abc_negative_cache.add(subclass) file "c:\python27\lib\_weakrefset.py", line 86, in add together self.data.add(ref(item, self._remove)) typeerror: cannot create weak reference 'classobj' object

test.geometry("300 x 200") should be: test.geometry("300x200")

also, create sure right in how installed tkinter. on linux machine, use:

sudo apt-get install python-tk

you can seek looking @ next similar question: making python script executable causes 'import site' failed; utilize -v traceback (mac osx)

python user-interface tkinter

No comments:

Post a Comment