[英]Same Program Runs Fine when ran from IDLE but not when ran directly
I wrote a small Tkinter based GUI app on python. 我在python上编写了一个基于Tkinter的小型GUI应用程序。 It worked fine when run with IDLE, but displays moduleError on running it directly. 与IDLE一起运行时,它工作正常,但在直接运行它时显示moduleError。 I am on windows. 我在窗户上。 Running it directly means double-clicking the .py file. 直接运行它意味着双击.py文件。 Here's the link to the code. 这是代码的链接。 I have the path to python appended in the PATH environment variable 我在PATH环境变量中附加了python的路径
http://codepad.org/ezxcpi7Y http://codepad.org/ezxcpi7Y
And the error image: 和错误图片:
Why i am getting that error? 为什么我收到该错误? Please help 请帮忙
You need to import tkinter.messagebox
您需要import tkinter.messagebox
IDLE(writen in tk) imports this module in tkinter (python not imports modules twice). IDLE(用tk编写)在tkinter中导入此模块(python不会两次导入模块)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.