[Sugar-devel] Help Needed - Convert python code into Sugar

Aleksey Lim alsroot at member.fsf.org
Fri Jun 18 10:12:10 EDT 2010


On Fri, Jun 18, 2010 at 01:48:56PM +0000, Sascha Silbe wrote:
> Excerpts from John Samuel's message of Thu Jun 17 10:28:52 +0000 2010:
> > Hi, this is John Samuel here.I am new to Sugar. I've made a small program in python for the viewing of images.It runs perfectly as a standalone program, but when I convert it into Sugar, it runs in a different window coz of which it cannot be stopped.I have to close Xephyr and run it again.I use Sugar .88 on Ubuntu 9.10 KarmicCould anyone please help me?
> 
> > I've attached my code along with this mail.
> I'd suggest starting by converting the code to use GTK instead of TK. Python-tk is not being installed on most systems running Sugar (see the Sugar Platform page [1] for a list of packages that should be available on all systems). Also with GTK it will be much easier to integrate into Sugar; you can use several GTK-based widgets made specifically for Sugar (the sugar.graphics submodules on [2]), in addition to the regular activity framework (sugar.activity) that I highly recommend to build on. It'll make Sugar integration much easier.
> It might be quite a bit of work to switch to GTK, but it'll pay off in the long run. AFAIK nobody has tried making a TK-based application yet and Sugar is still a bit peculiar about how it expects windows to appear.

> If you nevertheless decide to keep using TK, the low-level activity API page has some details [3] on what X11 properties need to be set to make Sugar recognize your window.

Polyol[4] is designed exactly for this purpose, these are C libraries
that should cover all sugar related low level routines, starting from
getting sugar environment settings via full featured sugar GUI to high
level stuff i.e. what sugar-toolkit does for python based activities.
It is not yet finished (but already in some useful stage, I'm using it
for C based GCompris and less for Tuxpaint) and contains only python
binding for now.

> [1] http://wiki.sugarlabs.org/go/0.88/Platform_Components
> [2] https://api.sugarlabs.org/
> [3] http://wiki.sugarlabs.org/go/Development_Team/Low-level_Activity_API#X_Properties

[4] http://wiki.sugarlabs.org/go/Activity_Team/Polyol

-- 
Aleksey


More information about the Sugar-devel mailing list