Hi, I am using wxPython as a front-end GUI for a tool used to add extra content to my program. This tool creates a window where a 3D world is rendered to. This has a non returning main loop. The problem is that when you start the wxPython GUI you have to call app.MainLoop() which is also a non-returning main loop. For performance reasons, how do I keep my 3D application’s main loop and handle wxPython’s events from that main loop, instead of calling app.MainLoop() which starts the GUI but essentially stops the 3D engine dead in its tracks?
I have no idea how to tackle this as I have no in-depth experience with wxPython and its inner-workings.
I would recommend threading your 3dTools main loop and using Pubsub to
talk between the two
···
On 2/19/07, rlorgat <rlorgat@webafrica.org.za> wrote:
Hi, I am using wxPython as a front-end GUI for a tool used to add extra
content to my program. This tool creates a window where a 3D world is
rendered to. This has a non returning main loop. The problem is that when
you start the wxPython GUI you have to call app.MainLoop() which is also a
non-returning main loop. For performance reasons, how do I keep my 3D
application's main loop and handle wxPython's events from that main loop,
instead of calling app.MainLoop() which starts the GUI but essentially stops
the 3D engine dead in its tracks?
I have no idea how to tackle this as I have no in-depth experience with
wxPython and its inner-workings.
wx.lib.pubsub does not use any specialized wx calls to ensure thread
safety between mainthread and non-mainthread calls.
- Josiah
···
"Dj Gilcrease" <digitalxero@gmail.com> wrote:
I would recommend threading your 3dTools main loop and using Pubsub to
talk between the two
On 2/19/07, rlorgat <rlorgat@webafrica.org.za> wrote:
> Hi, I am using wxPython as a front-end GUI for a tool used to add extra
> content to my program. This tool creates a window where a 3D world is
> rendered to. This has a non returning main loop. The problem is that when
> you start the wxPython GUI you have to call app.MainLoop() which is also a
> non-returning main loop. For performance reasons, how do I keep my 3D
> application's main loop and handle wxPython's events from that main loop,
> instead of calling app.MainLoop() which starts the GUI but essentially stops
> the 3D engine dead in its tracks?
>
> I have no idea how to tackle this as I have no in-depth experience with
> wxPython and its inner-workings.
>
> Thanks
>
> Raeez
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
wx.lib.pubsub does not use any specialized wx calls to ensure thread
safety between mainthread and non-mainthread calls.
But I've often thought that it would be a nice feature to add. Some sort of way to specify that a subscriber should receive its messages in a particular thread. If that thread is the GUI thread then pubsub could use an adapter that uses wx.CallAfter to send the message. If it's some other thread then the adapter can post the message to a Queue, and also provide some ProcessQueue method that the thread can periodically call to dispatch any pending messages. And if the sender is already operating in the same thread that the subscriber wishes to receive messages in then the adapter can just send the messages directly. The only problem with this is that the sender doesn't have an easy way to know when all the messages have been processed, or to get results from the subscribers. So now, although it is doable, it becomes a much more complex problem and I decide I have more productive things to work on.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!