sugar-toolkit-gtk3/examples/toggletoolbutton.py
Hrishi c7d1c7acfb Write documentation for sugar3.graphics.ToggleToolButton
- add one example,

- part of feature Sugar3 Docs,
  https://wiki.sugarlabs.org/go/Features/Sugar3_Docs

Signed-off-by: James Cameron <quozl@laptop.org>
2016-12-31 07:57:52 +11:00

34 lines
775 B
Python

from gi.repository import Gtk
from sugar3.graphics.toolbarbox import ToolbarBox
from sugar3.graphics.toggletoolbutton import ToggleToolButton
import common
test = common.Test()
test.show()
vbox = Gtk.VBox()
test.pack_start(vbox, True, True, 0)
vbox.show()
toolbar_box = ToolbarBox()
vbox.pack_start(toolbar_box, False, False, 0)
toolbar_box.show()
favorite_button = ToggleToolButton('emblem-favorite')
favorite_button.set_tooltip('Favorite')
toolbar_box.toolbar.insert(favorite_button, -1)
favorite_button.show()
favorite_button2 = ToggleToolButton('emblem-favorite')
favorite_button2.set_tooltip('Favorite')
toolbar_box.toolbar.insert(favorite_button2, -1)
favorite_button2.set_active(True)
favorite_button2.show()
if __name__ == '__main__':
common.main(test)