Script works in IDLE, but .py-file doesn't work

前端 未结 6 1935
误落风尘
误落风尘 2020-12-31 17:40

I have a tkinter script, which runs just fine in IDLE. However, when I double click the .py-file from Windows Explorer, the console window flashes half a second and then it

6条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-31 18:36

    IDLE uses Tkinter as its graphical environment. It is possible that your code is relying on a side effect of an import by IDLE itself. This is especially true if you use IDLE without a subprocess.

    The simpledialog module does not import when using from tkinter import *. Try adding this to your code:

    import tkinter.simpledialog as simpledialog
    

提交回复
热议问题