mainloop prevents Tkinter application to run from the IDLE

前端 未结 1 1123
一生所求
一生所求 2021-01-15 23:35

When using Ubuntu, I am able to play with Tk in real-time, by writing commands in the IDLE.

On Windows, I need to call root.mainloop

相关标签:
1条回答
  • 2021-01-15 23:49

    I don't have a complete solution or answer, but here is something that I found on the subject:

    From this page: Thinking in Tkinter

    Note that you should not run these programs under IDLE. IDLE is itself a Tkinter application, with its own "mainloop" that will conflict with the mainloop in these programs. If you really want to view and run these programs using IDLE, then -- for each program -- you should comment out the "mainloop" statement in the program before running it.

    I'm not too sure about the technical reasons behind it -- but I just don't run Tkinter code from IDLE.

    0 讨论(0)
提交回复
热议问题