我正在尝试执行以下代码片段:
import easygui
from Tkinter import *
easygui.msgbox('Hello')
但它返回以下错误:
NameError Traceback (most recent call last)
<ipython-input-35-28d6ffa54e48> in <module>()
----> 1 easygui.msgbox('Hello')
/usr/local/lib/python2.7/dist-packages/easygui/boxes/derived_boxes.pyc in msgbox(msg, title, ok_button, image, root)
214 root=root,
215 default_choice=ok_button,
--> 216 cancel_choice=ok_button)
217
218
/usr/local/lib/python2.7/dist-packages/easygui/boxes/base_boxes.pyc in buttonbox(msg, title, choices, image, root, default_choice, cancel_choice)
64 boxRoot.withdraw()
65 else:
---> 66 boxRoot = Tk()
67 boxRoot.withdraw()
68
NameError: global name 'Tk' is not defined
我尝试使用导入 Tkinter 的各种组合进行故障排除-
import Tkinter as Tk
import Tkinter
from Tkinter import *
但它们都不起作用。我安装了这两个软件包的最新版本。怎么了?