I need to make an app that has an interface in TkInter that responds to events triggered by an HTTPServer. The issue is that HTTPServer.serve_forever() blocks the main thread. I can run the server in another thread, but than how can I trigger TkInter events? Any ideas?
Asked
Active
Viewed 200 times
0
-
Read [use threads to preventing main event loop from “freezing”](https://stackoverflow.com/a/16747734/7414759) – stovfl Nov 11 '19 at 21:20
-
That's a way to go around long running operations. In my case I am going to have a constantly running HTTP server and a constantly running TkIntet UI. What I need is a way to pass messages between them. I am reading about shared memory now, but it sounds like it's a mass. Let's see if I can figure it out. – Bogdan Nov 11 '19 at 23:49
-
***"have a constantly running HTTP server"***: There is no difference between **long running** and **constantly running**. In your case you start the background `Thread` **once**. ***"shared memory"***: Using `Thread` you don't need that, read [multiprocessing-vs-threading](https://stackoverflow.com/questions/3044580/multiprocessing-vs-threading-python) – stovfl Nov 12 '19 at 07:46
-
Thank you! After some research I figured it out using threads. – Bogdan Nov 12 '19 at 23:37