A butterfly

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 stats


You might also like
Attenborough - Anaconda gives birth underwater - BBC wildlife
Attenborough - Anaconda gives birth underwater - BBC wildlife
Software Development Abstract Background
Software Development Abstract Background
Python Hatching in Florida 04, Time Lapse Speed x2
Python Hatching in Florida 04, Time Lapse Speed x2



Burmese Python strikes/constricts guinea pig #2
Burmese Python strikes/constricts guinea pig #2
Elite: Dangerous Beta 3.9.0 :: E13 :: Orca and Python Spotted!
Elite: Dangerous Beta 3.9.0 :: E13 :: Orca and Python Spotted!
The Brutal Cycle of Life
The Brutal Cycle of Life


Related Posts