Computer Science Canada
Wait for mouse button press (outside of callback)
|Author:||np_123 [ Sat Jan 27, 2018 6:44 pm ]|
|Post subject:||Wait for mouse button press (outside of callback)|
I create a window and the below code is the callback for it.
What I'm looking for is a way to wait for those events to happen, using the callback essentially as a trigger. But doing something like toggling a boolean variable and having a loop waiting for it would cause the UI to hang as it's event-driven. Any suggestions?
|Author:||np_123 [ Sat Jan 27, 2018 8:31 pm ]|
|Post subject:||RE:Wait for mouse button press (outside of callback)|
Nvm figured it out.
I reversed my logic as in:
My non-callback function continuously returns a boolean value determined by an internal variable. I loop on this function, waiting for it to be True. (I assume because it's always entering & returning the procedure, that's why it doesn't hang).
When the callback registers a click it sets the variable to True. This causes the function to return True. Problem now solved.