
Life cycle of a Python
I've got an issue with working with the threading class within a Tkinter GUI. On initiating the Tkinter GUI, I create new Threading & Queue objects with a daemon and start it. In the Tkinter GUI, I have a button that calls an internal method. This method then calls put on the Queue object and is posted below. The Threading object performs all the necessary actions that I expect.
def my_method_threaded(self, my_name): try: self.queue.put(("test", dict(name=my_name))) self.label_str_var.set('') self.queue.join except: self.error_out(msg=traceback.format_exc)
However, I am encountering an issue AFTER it has finished. If I call self.queue.join, then the set call is never executed and the app freezes after the thread has completed its task. If I comment out the join command, the set call IS executed, but the button will only work the first time, after it does nothing (I am tracking what the run method is doing using a logger. It is only ever called the first time).
I am assuming there is an issue with calling join and the Tkinter loop, which is why the first issue occurs. Can anyone shed any light on the second issue? If you need more code, then let me know.
Traffic statsYou might also like





