开发者

mainloop prevents Tkinter application to run from the IDLE

开发者 https://www.devze.com 2023-02-10 17:44 出处:网络
When using Ubuntu, I am able to play with Tk in real-time, by writing commands in the IDLE开发者_Python百科.

When using Ubuntu, I am able to play with Tk in real-time, by writing commands in the IDLE开发者_Python百科.

On Windows, I need to call root.mainloop() to spawn a window, and the loop keeps me from running any code from IDLE.

Is it a matter of platform, or am I doing something wrong?


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

精彩评论

暂无评论...
验证码 换一张
取 消