[Sugar-devel] PyGame/ Sugargame issues with GTK 3

James Cameron quozl at laptop.org
Mon Feb 24 23:36:12 EST 2014


On Mon, Feb 24, 2014 at 11:14:08PM -0500, Sebastian Silva wrote:
> I've often seen mention of these incongruencies between pygame and
> python-gtk.  What are the most annoying issues? I know the two
> stacks are completely different, so integration might be an issue,
> but other than that, are there more serious issues?

Yes, the stacks have differences.  Pygame is based on SDL, and SDL is
based on X.  Python-gtk is based on GTK+, and GTK+ is based on GDK
which is based on X.

Both create X windows on the X display.  SDL creates one X window for
the display surface.  GTK+ and GDK may create an X window for each
widget.

Pygame programs usually consist of a main loop, under direct control
of the programmer, that does rendering actions and processing keyboard
and mouse events.

GTK+ programs usually consist of a main loop, under control of GTK+,
that processes keyboard and mouse events, and these event handlers do
rendering actions.

sugargames and olpcgames attempt to bring the two stacks together at
their peak; by creating the pygame display surface as an X window
inside a GTK+ widget, and by providing a common main loop to handle
events and rendering actions at the same time.

In the history of problems encountered with sugargames and olpcgames,
the usual causes are coding errors, where either the conditions of the
marriage are violated, or where events are mishandled.

Animation flow performance problems often stem from trying to demand
more rendering actions than can fit in the available CPU time; this is
always a problem with pygame.

-- 
James Cameron
http://quozl.linux.org.au/


More information about the Sugar-devel mailing list