[pygtk] Using pyGtk with Panda3D (threads, slicing up GTK)

Jeremy Morel morel.jeremy at gmail.com
Wed May 23 22:10:56 WST 2007


Hi list !

I am trying to make pyGtk and Panda3D run together. Panda3D is a 3D engine
(available at http://panda3D.org) which provide very basic Gui. I am
therefore trying to use Gtk as an alternative (and much more powerful) Gui.

I thougth at first that I could run both Panda and gtk in two different
threads. But it appears that Panda will only run if it is in the main thread
(it is said in the documentation) and that Gtk doesn't run "normally" in a
non-main thread.

I went to the IRC channel to ask how I can make pyGtk running in a thread,
and someone (I'm sorry, I forgot the nickname)told me that there may be an
other solution.

Panda uses tasks to run. Tasks are small functions, executed one after
another one in every iteration of Panda's main loop. I can add tasks, remove
them, etc... These tasks have to be quick, for following tasks wait for the
previous one to finish to begin.

The person on IRC told me that it is possible to put gtk in one of those
tasks, but he did not know how. I imagined that it may be something like
slicing up the gtk.main() and putting the slices in tasks. But I think I am
wrong (just an idea)

I also need to make Panda and Gtk to talk together. With threads, I would
have used two Queue() (one for each direction : Panda -> Gtk and Gtk ->
Panda), and each side would only do put(), and the other one get(). I
planned to use the gtk.add_idle function to add a function which listens to
these Queues, but it now seems irrelevant.

Do you have an idea for my problem ?

Thanks in advance,

Jeremy Morel

PS : sorry for the poor english, I am not used to discuss technical topic,
especially in english
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20070523/8b1623c3/at=
tachment-0001.htm


More information about the pygtk mailing list