search

Home  >  Q&A  >  body text

python - 包含tkinter的py文件闪退

from tkinter import *
ro = Tk()

python3.4,windows8.1 *64

这句话在交互命令行里是可以执行的,在IDE里也没报错,只是双击打开就会闪退。

在.py里使用其他的都可以正常打开,但是再用tkinter时就会闪退,请问这是为什么?如何解决? 谢谢

伊谢尔伦伊谢尔伦2803 days ago1294

reply all(3)I'll reply

  • 巴扎黑

    巴扎黑2017-04-17 17:56:13

    There is no raw_input() in python3. If an error occurs, an exception will be thrown. If it is not handled, it will exit

    reply
    0
  • PHPz

    PHPz2017-04-17 17:56:13

    You saved the .py file and directly double-clicked it to execute it?

    The above code is problematic, but the crash prevents you from even seeing the error message.

    So, you have to use the correct posture to open the .py 文件,在 Windows file. Under Windows, it is best to do this:

    After executing this, you will see the output and error information in another window.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 17:56:13

    from tkinter import *
    ro = Tk()
    ro.mainloop()

    Try adding the last line

    reply
    0
  • Cancelreply