Write your own Sugar desktop activity

Most Sugar desktop activities are written in Python, using our GTK+ 2.0 or GTK+ 3.0 libraries. This page shows how to develop an activity using Python with GTK+ 3.0.

Some Sugar desktop activities are written in languages other than Python, such as Smalltalk, C, and JavaScript. For new activities to run on both Sugar desktop and Sugarizer, please consider Write your own Sugar web activity.

Setting up a development environment

You must first setup a development environment, for testing your activity and releasing it for distribution.

Create a new activity from a template

Locate the activity directories. They may include:

Each installed activity is in a directory under the activity directories. This is where you will create your new activity.

Clone the Hello World activity from hello-world on GitHub:

Use the .activity suffix in the directory name of an activity, because that's the way an activity bundle is released.


Your clone of the Hello World activity contains a file, activity/activity.info:

You must set a new name and a unique bundle_id for your activity.

Avoid punctuation in your bundle_id, e.g., org.sugarlabs.my-activity-name is not valid. Instead, use CamelCase, e.g., org.sugarlabs.MyActivity.

You should change the Activity class in your activity.py file, e.g., from:


You must change the exec field as well, e.g., from:


You should set the repository field to the URL of the git repository of your project.

And we recommend that you use a GPLv3+ license.

Your activity.info file will look something like:

To read more about the activity.info file, see Activity Bundles on our Wiki.

You must make your activity icon unique in the Sugar interface by making a new one, or borrowing from another icon and making changes. Ask for help from the community if you don't feel comfortable with graphic design.

Here is activity/activity-helloworld.svg;

![Activity Icon](images/activity-helloworld.svg "Activity icon")

You should rename this file and change icon in the activity.info file.

Your activity icon must follow the guidelines as decribed in The Sugar Interface: Icons on our Wiki.

There is a helper script, Sugar Iconify that will help you create Sugar-compliant icons.

Of course, the interesting changes will be the ones you make to the activity itself. Below you will find links to some resources on Sugar Activity development, but perhaps the best way to get started is to modify an existing activity that has features similar to the one you want to create.

Running your activity

Launch Sugar and your new activity should be immediately available, although since it has not yet been selected as a favorite, it will not appear by default on the Sugar Home View (F3). You need to either;

If all goes well, your activity will launch.

There are many opportunities to make mistakes. Don't get discouraged, as debugging is a great way to learn. One useful tool is the Log Activity, which will show you the log files of the operating system, Sugar and activities. Alternatively, you can look at the log files from the command line.

Log files are usually in the directory ~/.sugar/default/logs.

Log files for sugar-build are in the directory ~/sugar-build/home/dotsugar/default/logs.

Log files are named using the bundle_id.

You may also test interactively by starting Terminal, then cd to the activity directory, and type:

File structure

All activities should follow this file structure:


Sugar serves a global audience, so it is important to enable your activity for internationalization and localization. A guide to best practices is on our Wiki.

Revision control your code

For development you can initialize the repository as a git repository. This will help you to track your changes. First use git init to initialize the repository:

With git status you can show the available files in the folder they are still untracked. Now add all the files in the directory and commit those changes, you can use git status again to see the current state:

We recommend that you use github to host your activity.

Ready to release

Once your activity is working, you can ask to have your activity repository hosted under the Sugar Labs github organization.

Make an XO bundle and upload it to the Sugar Activity Library http://activities.sugarlabs.org/ (ASLO).

After that, users of Sugar can download and install your activity.

For further releases, you should update the activity_version in activity/activity.info.

More details

Documentation for our GTK+ 3.0 toolkit sugar-toolkit-gtk3 is available here.

A Python GTK+ 3.0 tutorial is available here.

You may read this book by James Simmons on how to make Sugar activities, available at Make Your Own Sugar Activities.

Coding standards

We currently use Python Version 2.7 for the Sugar toolkit and Sugar activity development.

We recommend flake8 as a wrapper around the pep8 and pyflakes code checkers.