Does Tkinter work?
I have installed Python 3.2 from: http://wiki.python.org/moin/TkInter.
Step 3 - does Tkinter work?
Try the following command at the Python prompt:
Tkinter._test() # note underscore in _test. Also, if you are using Python 3.1, try tkinter._test() instead. This should pop up a small window with two buttons.
>>> Tkinter._test
Traceback (most r开发者_StackOverflow社区ecent call last):
File "<pyshell#4>", line 1, in <module>
Tkinter._test
NameError: name 'Tkinter' is not defined
>>> tkinter._test
<function _test at 0x00000000028FD2C8>
However, no 'window with 2 buttons'. Ideas?
Run tkinter._test()
. Note the parenthesis.
Use:
tkinter._test()
Note the parentheses - they are imperative when calling a function. It is if you are calling a function with arguments.
To test if a module has imported correctly (this works for any module) try:
import [module name here]
print([module name here])
An example would be:
import tkinter
print(tkinter)
In your sample code, you forgot to include the parentheses after test. Test is, indeed, a function so it needs parentheses:
tkinter._test()
精彩评论