Changes

Jump to navigation Jump to search
no edit summary
Line 2: Line 2:     
<h1>Class: Activity</h1>
 
<h1>Class: Activity</h1>
<h3> How do I create a new activity that is derived from the base Activity class?</h3>
+
=== How do I create a new activity that is derived from the base Activity class? ===
   −
The following code creates a simple activity called ToolbarExample:
+
All activities must implement a class derived from the 'Activity' class. The convention is to call it ActivitynameActivity, but this is not required as the activity.info file associated with your activity will tell the sugar-shell which class to start.
   −
{{{
+
from sugar.activity import activity
from sugar.activity import activity
+
...
class ToolbarExample(activity.Activity):
+
class ToolbarExample(activity.Activity):
 
+
    def __init__(self, handle):
+
    def __init__(self, handle):
        activity.Activity.__init__(self, handle)
+
        activity.Activity.__init__(self, handle)
}}}
 
Anonymous user

Navigation menu