controling a pyglet window from a gui program

403 visningar
Hoppa till det första olästa meddelandet

fccoelho

oläst,
26 okt. 2007 10:58:592007-10-26
till 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

oläst,
26 okt. 2007 20:44:122007-10-26
till 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

oläst,
27 okt. 2007 07:56:222007-10-27
till 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

oläst,
27 okt. 2007 09:22:122007-10-27
till 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

oläst,
29 okt. 2007 13:58:302007-10-29
till 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.
>

Svara alla
Svara författaren
Vidarebefordra
0 nya meddelanden