[IAEP] Creating Your First Sugar Activity
James Simmons
jim.simmons at walgreens.com
Mon May 11 10:58:57 EDT 2009
Kathy,
When I read your original email about not knowing where to start with Python I thought I'd answer because I went through the same thing not long ago. Here's my advice:
1). Don't try to write a Sugar Activity right away. Instead, write a standalone Python program that does what you want, then convert it to a Sugar Activity, being sure to keep a copy of the non-Sugarized version around for future use. There are several reasons for this, but the chief one is that standalone programs are easier to test, especially in your case since you are not currently a Linux user. A standalone Python program can run anywhere, but a Sugar Activity really needs Sugar running on top of Linux. You can run your standalone Python program on an XO using the Terminal Activity.
When I add new features to My Sugar Activities I generally try to get the feature working on the standalone version first. I did this with text to speech, for instance. This was useful because when I ran into problems I had a standalone app I could send to the speech-dispatcher mailing list so they could easily recreate my problem.
2). Sugar Activities are generally made with pygtk or pygame, and I believe pygtk is the more common of the two. These are both cross platform and have online tutorials, as does Python itself:
http://www.python.org/
http://www.pygtk.org/
http://www.pygame.org/news.html
3). You'll want a good code-highlighting editor that understands Python. A couple of good ones:
Eric: http://eric-ide.python-projects.org/eric4-download.html
Gedit: http://projects.gnome.org/gedit/
These are a bit more complicated to install than typical Windows programs. They are included in every Linux distribution, though.
4). To make and test a Sugarized Activity you really should have a Linux distribution installed. The best for this purpose is probably Fedora 10, which includes the Sugar environment, eric, gedit, python, pygame, pygtk, a tool for making SVG icons, and lots of other useful stuff. You can run Linux on the same computer as Windows XP and choose which one you want to run at boot time. Your email suggests that you have done some professional programming, and if so you really need to try Linux. At work I have installed Linux on a series of computers the company had considered only good for spare parts, and they have been incredibly useful to me in my work.
If you don't want to have anything to do with Linux you could make a standalone Python program and find a collaborator to Sugarize it for you. You could also attempt to develop your Activity using Sugar on a Stick, or an actual XO, but this might be more trouble than simply installing Fedora 10.
5). When you are ready to Sugarize your Python program, read these articles:
http://wiki.sugarlabs.org/go/Development_Team/Almanac
http://wiki.laptop.org/go/Beyond_Hello_World
Feel free to ignore any of this advice if it doesn't seem applicable. I hope that you'll find it gives you a place to start.
James Simmons
Message: 1
Date: Fri, 8 May 2009 15:28:53 -0700
From: "Kathy Pusztavari" <kathy at kathyandcalvin.com>
Subject: Re: [IAEP] [Sugar-devel] versus, not
To: "'iaep'" <iaep at lists.sugarlabs.org>
Message-ID: <040301c9d02c$5f346ee0$6401a8c0 at CAPTAINCRUNCH>
Content-Type: text/plain; charset="iso-8859-1"
David,
Do you have any good links for those of us just starting? Links that would
answer how to install python, how to interface with sugar from a different
platform (XP, Mac), sugar specific issues in developing activities in
python?
-Kathy
More information about the IAEP
mailing list