[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Timer pygame and gtk



As a personal experience, I can say that is a way that you don't want to walk. Each library has their own event handler and it's very hard to manage both properly.

But if you really want to do that, is not really hard, just call the pygame environment on a GTK event. The only thing you should have in mind is to trigger all the pendents events before to call pygame. Something like:

while gtk.events_pending():
       gtk.main_iteration(False)

Because if you don't do that, it will be GTK events that will be processed after the pygame call.

But again, it's not good to mix 2 libraries of this kind.

2010/5/13 Alkatron <Alkatron@xxxxxxxxxxx>
I need a timer that run a function at specific interval, pause, continue, and stop....

I tryed with thread module but i'm becaming crazy (doesnt' stop, sometimes run, other not, etc)

I saw that with pygame the matter seems to be easyer, but i have a newbie problem....

How do i integrate a pygame loop inside a gtk loop?

I discover too late that pygame has its own gui module, so now i would like to mantain the application with gtk and use a pygame timer.....is it possible?



Thank to all

Alkatron



--
Pablo Recio Quijano

Estudiante de Ingeniería Informática (UCA)
Alumno colaborador del Departamento de Lenguajes y Sistemas Informáticos