Spielend programmieren lernen

Programmierkurse für Kinder, Jugendliche und Erwachsene

User Tools

Site Tools


en:blog:2011:0918_pygame-on-sugar

pygame on sugar

ThePythonGameBook on sugar (One laptop per child project, XO, OLPC)

I was last weekend in Paris at the Sugarlab conference, organised by the nice folks of OLPC France. Sugar is a kind of linux user interface designed specifically for the XO (100$-Laptop, One-Laptop-per-Child OLPC). Sugar works also without an original XO: You can download “sugar on a stick”, basically a customized Fedora-Linux and boot your PC from this usb stick or you can install (somewhat out-dated) sugar packages for Ubuntu-Linux and other Linux distros.

Sugar logo

Naturally i was interested in how my ThePythonGameBook would look and feel using sugar and using one of the XO-Laptops.

I found out that python and pygame is already pre-installed on the XO and it was possible to look at various chapters of ThePythonGameBook with Sugar's Browser, copy the code-examples by the Clipboard (CTRL+C, CTRL+V) into an sugar activity called Pypi and run the examples using pypi's run-button.

The good news:

  • it is possible to run complicated demos with several sprites on the XO with acceptable speed
  • the code is syntax-highlighted by pypi and changeable by the user
  • sugar apps are written in python and PyGtk

The bad news:

  • There is no reasonable easy-to-use file manager. All games that make use of other files (graphic, sound, python modules) are hard to install on the XO
  • There is no pygame window decoration on sugar. a pygame window is NOT maximized, it simply has no window decoration. No minimze, maximize and close button. Pygame's pygame.display.set_caption(“foo”) command is useless
  • Sugar philosophy does not allow that one sugar activity (like code editor) starts another sugar activity (code zipper)

This means that at present state, only around half of the code examples in ThePythonGameBook are useful for an XO user. Biggest problem is downloading and unzipping files from the command line.

I also got deeper insight into sugar's unique file-system philosophy. All files in sugar created by “activitys” (painting, writing, taking photos..) are saved automatically with the filename “data” (!) into an new created directory. The name of the new created directory (one for each file) is generated by sugar and looks like a very long serial number. Those directorys are created physicalle somewhere under ~/.sugar.

Inside each directory is also a new directory created (i forgot the name) wich is filled from sugar with little files describing the “data” file. User-made description, date, mime-typ, screenshot etc. are all stored here into little files. Basically it is a big file-based database on harddisk.

At the Sugarlab conference, i discussed this problem with some of the sugar developers. There was no instant solution but those possible pathways were discussed:

  • Some sugar activitys (memory?) already have a feature to pack several files into one zip-file and this zip-file is maintained by the sugar file system. I could modify this code for ThePythonGamebook, writing an sugar activity that zips, display, run and unzips code-examples.
  • I could try to modify the PiPi code editor to my needs (using PyGtk)
  • I could modify most examples in ThePythonGameBook so that only one file is necessary instead of several files and a zip/unzip
  • I could make use of IDLE, wich is downloadable for Sugar. That still does not solve my zip/unzip problems but at least i could use IDLE's open/save dialoag as a crude file manager
  • There is a not-maintained activity called “developer” wich used an program editor and included a little file manager. I could try to resurrect this activity.

Sadly, i made a lot of photos of the conference but my mobile phone(with the camera) got stolen near theParis metro station Stalingrad. You can hear some recorded interviews (in English) and a podcast about the conference (in German) at my Biertaucher-Podcast site:

First PagePrevious PageBack to overviewNext PageLast Page

/var/www/horst/spielend-programmieren.at/data/pages/en/blog/2011/0918_pygame-on-sugar.txt · Last modified: 2017/10/25 15:10 by horstjens@gmail.com