Possible Duplicate:
Script works in IDLE, but .py-file doesn't work
所以我用python3.2.2的IDLE用python的tkinter编写了一个gui。当我在交互模式下从空闲状态运行程序时,一切正常,但是当我通过双击它或从命令提示符运行它时,它会产生一个错误,并且不会启动程序。我知道问题出在这条线上:
path_da=self.simdia.askstring("Path to start","Paths must be relative!")
我从金特进口了所有的东西。 path_da被假定为askstring对话框中的字符串。 我在类中将simdia设置为simpledialog作为公共变量。 我只是不明白为什么在空闲状态下使用F5运行它,而不是从命令提示符下运行它
我将此标记为dupe,因为使用
simpledialog.askstring
而不从tkinter
模块导入simpledialog
时收到的错误与使用simpledialog
时相同。如果它不被认为是重复的,答案如下:引用Roger's answer对类似的问题:
尝试将此添加到代码中:
^{pr2}$相关问题 更多 >
编程相关推荐