1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
import gtk
from sugar.graphics.radiopalette import RadioPalette, RadioMenuButton, \
RadioToolsButton
from sugar.graphics.toolbutton import ToolButton
from sugar.graphics import style
window = gtk.Window()
box = gtk.VBox()
window.add(box)
toolbar = gtk.Toolbar()
box.pack_start(toolbar, False)
text_view = gtk.TextView()
box.pack_start(text_view)
def echo(text):
text_view.props.buffer.props.text += "\n" + text
palette = RadioPalette()
palette.append(
icon_name='document-open',
tooltip='menu.document-open',
toggled_cb=lambda: echo('menu.document-open'))
palette.append(
icon_name='document-save',
tooltip='menu.document-save',
toggled_cb=lambda: echo('menu.document-save'))
palette.append(
icon_name='document-send',
tooltip='menu.document-send',
toggled_cb=lambda: echo('menu.document-send'))
button = RadioMenuButton(palette=palette)
toolbar.insert(button, -1)
palette = RadioPalette()
palette.append(
icon_name='document-open',
tooltip='tools.document-open',
toggled_cb=lambda: echo('tools.document-open'))
palette.append(
icon_name='document-save',
tooltip='tools.document-save',
toggled_cb=lambda: echo('tools.document-save'))
palette.append(
icon_name='document-send',
tooltip='tools.document-send',
toggled_cb=lambda: echo('tools.document-send'))
button = RadioToolsButton(palette=palette)
toolbar.insert(button, -1)
window.show_all()
gtk.main()
|