Changes
Development Team/Almanac/Code Snippets (view source)
Revision as of 08:11, 24 February 2007
, 08:11, 24 February 2007Added Entry and OptionMenu examples.
from sugar.graphics.toolbar import Toolbar
from sugar.graphics.toolbar import Toolbar
from sugar.graphics.iconbutton import IconButton
from sugar.graphics.iconbutton import IconButton
from sugar.graphics.entry import Entry
from sugar.graphics.optionmenu import OptionMenu
from sugar.graphics.menu import MenuItem
class FooActivity(activity.Activity):
class FooActivity(activity.Activity):
_ACTION_ANYTHING = 1
_ACTION_APPLES = 2
_ACTION_ORANGES = 3
def __init__(self, handle):
def __init__(self, handle):
activity.Activity.__init__(self, handle)
activity.Activity.__init__(self, handle)
button.connect("activated", self._button_activated_cb)
button.connect("activated", self._button_activated_cb)
toolbar.append(button)
toolbar.append(button)
entry = Entry()
button.connect("activated", self._entry_activated_cb)
toolbar.append(entry)
option_menu = OptionMenu()
option_menu.add_item(MenuItem(self._ACTION_ANYTHING, _('Anything')))
option_menu.add_item(MenuItem(self._ACTION_APPLES, _('Apples'),
'theme:stock-close'))
option_menu.add_item(MenuItem(self._ACTION_ORANGES, _('Oranges')))
option_menu.add_separator()
toolbar.append(option_menu)
textViewWidget = hippo.CanvasWidget()
textViewWidget = hippo.CanvasWidget()