Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/PascalTriangle.activity/pascaltriangle.py
diff options
context:
space:
mode:
authorPhilip Withnall <philip@tecnocode.co.uk>2013-08-16 17:43:39 (GMT)
committer Philip Withnall <philip@tecnocode.co.uk>2013-08-16 20:07:30 (GMT)
commitde301fe72296f113da2439d859cd73ea244c0151 (patch)
tree359928016716d2942a78eeb16533ce532f2c451c /PascalTriangle.activity/pascaltriangle.py
Initial commit of skeleton activity
This can be installed and run, but doesn’t draw anything or implement anything.
Diffstat (limited to 'PascalTriangle.activity/pascaltriangle.py')
-rwxr-xr-xPascalTriangle.activity/pascaltriangle.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/PascalTriangle.activity/pascaltriangle.py b/PascalTriangle.activity/pascaltriangle.py
new file mode 100755
index 0000000..825fc9f
--- /dev/null
+++ b/PascalTriangle.activity/pascaltriangle.py
@@ -0,0 +1,35 @@
+from sugar3.activity import activity
+from sugar3.graphics.toolbarbox import ToolbarBox
+import math
+from gi.repository import Gtk
+
+class PascalTriangleActivity(activity.Activity):
+ def __init__(self, handle):
+ activity.Activity.__init__(self, handle)
+
+
+ # Create the standard activity toolbox.
+ toolbar_box = ToolbarBox()
+ self.set_toolbar_box(toolbar_box)
+ toolbar_box.show()
+
+ # Create a new GTK+ drawing area
+ self.drawing_area = Gtk.DrawingArea()
+ self.drawing_area.connect('button-press-event',
+ self._drawing_area_button_press_cb, None)
+ self.drawing_area.connect('draw', self._drawing_area_draw_cb, None)
+
+ # Set the button to be our canvas. The canvas is the main section of
+ # every Sugar Window. It fills all the area below the toolbox.
+ self.set_canvas(self.drawing_area)
+
+ # The final step is to display this newly created widget.
+ self.drawing_area.show()
+
+
+ def _drawing_area_button_press_cb(self, widget, event, data = None):
+ pass
+
+
+ def _drawing_area_draw_cb(self, widget, ctx, data = None):
+ return False