in reply to Inserting Text into Listbox from a Thread
in thread Looping File transfer using SFTP in TK
Without doing the code for you, this is how you would do it.
1. Make $msg, and $msg_return shared variables.
2. Like I did with the file counter, setup a timer in the main thread to watch for the value of $msg. At the point where you test for $msg==2 in the thread, go into a wait-loop in the thread,waiting for the shared-value $msg_return == 1. When that happens, continue in the thread.
3. When the main thread detects, $msg==2, it can do whatever is needed, then set $msg_return=1 and $msg=0, so the thread can continue.
Remember, ALL Tk stuff has to be done in the main thread. All communication with the worker thread(s) has to be done through simple shared-variables.
|
|---|