Tkinter: Wait for item in queue
I’m using a queue to exchange messages between a background thread and a Tk GUI application. Currently, this is done by calling a query method every now and then. def read_queue(self): try: self.process(self.queue.get(False)) # non-blocking except Queue.Empty: pass finally: self.after(UPDATE_TIME, self.read_queue) The problem with this approach is that if UPDATE_TIME is too large, the application will process new items slower than possible. If it is too small, Tk spends most of the time checking the queue although it could do other stuff in the meantime. Is there a way to automatically trigger