How about giving flush_events() an until=condition and timeout=n keywords
so that flush_events becomes:
if timeout > 0: set timer event which triggers out_of_time
while get next event:
process event
if out_of_time or until(): break
Looking through wx I don't see how to "get next event", my choices being
run all events (MainLoop) or run pending events. I do see an "exit main
loop" function, so for wx at least one could redirect the event handler
for the window and run all the events, exiting the main loop when done,
but that seems ugly. I'll look around some more and see if I can find
the sleep until next event function in wx.
- Paul
···
On Wed, Feb 06, 2008 at 12:38:32AM +0100, Gael Varoquaux wrote:
On Tue, Feb 05, 2008 at 06:30:53PM -0500, Paul Kienzle wrote:
> Setting the timeout to 0.01s for the busy loop in ginput seems excessive.
> Since it is waiting for human interaction, generally 0.1 seconds is good
> enough.I had gone for that originally, but it looked quite ugly when moving the
window around. This busy waiting is quite ugly, but I have found a way of
avoid it. IMHO it should be done in the toolkit's event loop, but it
seems that trying to do it this would add gobbles of code for little
gain.