controling a pyglet window from a gui program

403 views
Skip to first unread message

fccoelho

unread,
Oct 26, 2007, 10:58:59 AM10/26/07
to pyglet-users
Hi,

Has anyone tried to control a pyglet window from a gui program? like a
pyqt application?

I want to know if there are any problems in switching from the PyQT
execution loop to the pyglet window and back...

thanks,

Flávio

Alex Holkner

unread,
Oct 26, 2007, 8:44:12 PM10/26/07
to pyglet...@googlegroups.com

Rather than switching between two event loops, you'll get better
behaviour by calling pyglet's `dispatch_events` functions from within
a QT idle event. (Not having used QT, I'm not sure of the name of
such an event, but it almost certainly exists).

Alex.

fccoelho

unread,
Oct 27, 2007, 7:56:22 AM10/27/07
to pyglet-users
Well I tried to find an event like that in the Qt 4 documentation but
couldn't.

I ask in the PyQt list and post the answer back here to help other
people who might be interested in this.

thanks

Alex Holkner

unread,
Oct 27, 2007, 9:22:12 AM10/27/07
to pyglet...@googlegroups.com
I found this in the Qt documentation at http://doc.trolltech.com/4.0/qeventloop.html:

To make your application perform idle processing, i.e. executing a special function whenever there are no pending events, use a QTimer with 0 timeout. More sophisticated idle processing schemes can be achieved using processEvents().

Should put you on the right track..

Alex.

fccoelho

unread,
Oct 29, 2007, 1:58:30 PM10/29/07
to pyglet-users
Thanks Alex,

That' what I needed, but you have to take care to start your time
consuming python function on a separate thread in order for the GUI to
get a chance to process its idle events...

thanks,

Flávio

On Oct 27, 11:22 am, "Alex Holkner" <alex.holk...@gmail.com> wrote:
> I found this in the Qt documentation athttp://doc.trolltech.com/4.0/qeventloop.html:


>
> To make your application perform idle processing, i.e. executing a special
>

> > function whenever there are no pending events, use a QTimer<http://doc.trolltech.com/4.0/qtimer.html>with 0 timeout. More sophisticated idle processing schemes can be achieved
> > using processEvents<http://doc.trolltech.com/4.0/qeventloop.html#processEvents>


> > ().
>
> Should put you on the right track..
>
> Alex.
>

Reply all
Reply to author
Forward
0 new messages