Tkinter and multi-threading

后端 未结 1 341
长情又很酷
长情又很酷 2021-01-16 03:34

I was using the following code to examine if Tkinter works along with multithreading. But the following code doesn\'t work (the Gui becomes unresponsive as soon as it runs).

相关标签:
1条回答
  • 2021-01-16 04:18

    It doesn't work because Tkinter doesn't support multithreading. Everything that interacts with a Tkinter widget needs to run in the main thread. If you want to use multithreading, put the GUI in the main thread and your other code in a worker thread, and communicate between them with a thread safe queue.

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