I'm building a GUI for a machine with Traits and TraitsUI. I would like the machine to perform an action as long as a button on the GUI is pressed and of course having the GUI not freeze and display the outcome of this continuous action, i.e. in a separate thread.
I can define in the class which inherits HasTraits
a button and a function which performs the actions when the button is pressed (def _button_fired:
), but it seems to me that the way the _button_fired
is defined, the GUI actually waits for the button-pressing to be over before performing the "Action". As stated above, I would like it to execute a function the second I press the button and stop this function execution (or execute a different function) when I release the button.
You can take as an example code snippet no. 7 from Gael's tutorial and just imagine that while pressing the button, the counter should increase.
Your help will be greatly appreciated.
Hellbourne