[Sugar-devel] Question about Sugarizing a Python program

Tony Anderson tony_anderson at usa.net
Tue Mar 7 19:20:32 EST 2017


I have good luck with two methods. One is to download helloworld-6.xo. 
It is actually a zip file and so can be unzipped.

The pertinent information is given in the activity.info file. Change all 
references to HelloWorld to your name for the activity.

A Sugar activity wants an svg icon to show on the Home view. So 
substitute your icon for the one in the activity folder.

The program is in directory activity.py as a python class. Change the 
class name to match the exec line in activity.info.

Usually what I do is make a bundle with python setup.py dist_xo (reset 
version in activity.info to 1 first). This bundle can be installed by
sugar-install-bundle hello-6.xo (substitute name of your bundle - e.g. 
spell-1.xo).

Now launching the activity should show hello world to show that your 
changes have created a working activity.

Now all that should be needed is to modify the activity to invoke your 
code. Note that you need much of the existing code to set up the Sugar 
toolbar. So I generally modify the code at the point that it provides a 
Gtk.Label('Hello World').

The other approach is to use pippy.py. Copy and paste your code into the 
text area. Now execute the code with pippy run to verify that it is 
working there.
Then you can export as a bundle (activity toolbar).

I fully endorse Sebastian's recommendation of James Simmons text. This 
will help with any problems you may encounter.

Tony

On 03/08/2017 04:53 AM, Sebastian Silva wrote:
>
> On 07/03/17 15:47, Sebastian Silva wrote:
>> Also, don't miss the excellent "Make Your Own Sugar Activities" by
>> James Simmons:
>>
>> http://write.flossmanuals.net/make-your-own-sugar-activities/introduction/
>>
> specifically the chapter:
>
> http://write.flossmanuals.net/make-your-own-sugar-activities/making-activities-using-pygame/
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel



More information about the Sugar-devel mailing list