in reply to Re^5: Annoying threads share problem!
in thread Annoying threads share problem!
If so, make @choices shared, and run a timer in main, which saves the old @choices and compares it to the current @choices, and updates the listbox when it detects a difference.
Alternatively, you could setup a few extra shared variables, one a flag, and one the new entry. When the thread wants to add a new entry to @choices, it sets the flag, and the new data to add.
Pretty much, either way, you are going to need a timer running in the main Tk thread to periodically check for changes. Tk will not watch across thread boundaries for variable changes, you have to actively read them.
Another idea, is setup some sort of binding on the listbox, that updates it's selections from @choices, everytime it comes into focus, or when the drop-down-selection list is triggered.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Annoying threads share problem!
by Ace128 (Hermit) on Oct 10, 2005 at 12:25 UTC | |
by zentara (Cardinal) on Oct 10, 2005 at 17:31 UTC | |
by Ace128 (Hermit) on Oct 10, 2005 at 19:19 UTC |