controling a pyglet window from a gui program

404 visualizzazioni
Passa al primo messaggio da leggere

fccoelho

da leggere,
26 ott 2007, 10:58:5926/10/07
a 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

da leggere,
26 ott 2007, 20:44:1226/10/07
a 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

da leggere,
27 ott 2007, 07:56:2227/10/07
a 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

da leggere,
27 ott 2007, 09:22:1227/10/07
a 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

da leggere,
29 ott 2007, 13:58:3029/10/07
a 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.
>

Rispondi a tutti
Rispondi all'autore
Inoltra
0 nuovi messaggi