DR0ID wrote:
and pushing the events on the pygame event loop could be dangerous because it is possible that there are already other events on the queue that will change the state of the application (or gui elements) so that at the time when your event gets processed it brakes (because the application isn't in the state anymore it was when the event was posted). This is a very subtle bug and difficult to catch. Not sure how to avoid that behavior
You could keep a list of functions waiting to be called, and process it in the event loop before reading the next event. I have something like this in Albow. It's more complicated because it allows you to schedule things to happen at a later time, but if you use a delay of 0 it has the effect we're talking about. -- Greg
