Skip to main content
 首页 » 编程设计

python之Tkinter 工作吗

2025年05月04日1652php

我已经从以下位置安装了 Python 3.2:http://wiki.python.org/moin/TkInter .

第 3 步 - Tkinter 工作吗?

在 Python 提示符下尝试以下命令:

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 recent call last): 
  File "<pyshell#4>", line 1, in <module> 
    Tkinter._test 
NameError: name 'Tkinter' is not defined 
 
>>> tkinter._test 
<function _test at 0x00000000028FD2C8> 

但是,没有“带有 2 个按钮的窗口”。 想法?

请您参考如下方法:

运行 tkinter._test()。请注意括号。