864 bytes added
, 18:09, 7 February 2007
m= Toolbar =
This snippet shows how an activity would have a toolbar with two buttons:
import hippo
from sugar.activity.Activity import Activity
from sugar.graphics.toolbar import Toolbar
from sugar.graphics.button import Button
class FooActivity(Activity):
def __init__(self):
Activity.__init__(self)
canvas = hippo.Canvas()
self.add(canvas)
canvas.show()
vbox = hippo.CanvasBox()
canvas.set_root(vbox)
toolbar = Toolbar()
vbox.append(toolbar)
button1 = Button('button1_icon')
button1.connect("activated", self._button1_activated_cb)
self.append(button1)
button2 = Button('button2_icon')
button2.connect("activated", self._button2_activated_cb)
self.append(button2)
[[Category:HowTo]]
[[Category:Sugar]]