Hello, I've gotten pretty well along with my project that involves running a pyglet window in a background thread. Now all that I need to implement is communicating with background windows. My strategy here is to figure out a way to send events to the windows, and have them respond as part of the event loop. That way, the event is handled in the background thread (good!). Just calling the relevant event handler from the foreground thread leads to the code being called in that thread's context, leading to seg-faults and the like.
So -- how can I, given a Window object, send that object an event? I noticed that windows seem to have an "_event_queue" attribute, which would be perfect. But just putting an event into the queue doesn't really do anything. Calling dispatch_event() on the window would seem to be the right thing to put the event into the queue, but it doesn't, since it seems that the window's _enable_event_queue attribute gets unconditionally set to False during the _setup() call in pyglet.app.BaseEventLoop. In this case, calling dispatch_event() then causes the event code to be run directly in the foreground thread. Anyhow, I of course have basically no idea how all of this fits together internally. Is there a simple and safe way to "send" an event to a Window object? If not, I'll just use a separate queue for sending events to the background thread, and install a function to periodically check the queue and dispatch events there. Once I have everything working, I'll post some skeleton code for other people to use. It's definitely handy... Thanks, Zach --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pyglet-users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pyglet-users?hl=en -~----------~----~----~----~------~----~------~--~---
