sugar-toolkit-gtk3/examples/tabs.py
Ignacio Rodríguez b6d449681d Example fixes
- replaced Gtk.HBox/Gtk.VBox by GtkBox as seen in [1] and [2]
GtkHbox and GtkVBox are deprecated
- use delete-event instead of destroy event in GtkWindow
- replaced icon_size for pixel_size where used
it's also deprecated as seen in commit [3]
- use sugar_theme in all examples; set it manually not by just
importing common module
- fixed GtkBox.pack_start arguments
- flake/pep8 fixes

[1] https://developer.gnome.org/gtk3/stable/GtkHBox.html
[2] https://developer.gnome.org/gtk3/stable/GtkVBox.html
[3] 5802d67ee1
2017-01-14 13:02:50 -03:00

47 lines
1018 B
Python

#!/usr/bin/python
from gi.repository import Gtk
from sugar3.graphics.icon import Icon
import common
test = common.Test()
test.show()
box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
test.pack_start(box, True, True, 0)
box.show()
# notebook without button
notebook = Gtk.Notebook()
box.pack_start(notebook, True, True, 0)
notebook.show()
for i in range(3):
hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
notebook.append_page(hbox, Gtk.Label('Page %d' % (i + 1)))
hbox.show()
# notebook with buttons
notebook = Gtk.Notebook()
box.pack_start(notebook, True, True, 0)
notebook.show()
add_icon = Icon(icon_name='add')
button = Gtk.Button()
button.props.focus_on_click = False
button.add(add_icon)
add_icon.show()
notebook.set_action_widget(button, Gtk.PackType.END)
button.show()
for i in range(3):
hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
notebook.append_page(hbox, Gtk.Label('Page %d' % (i + 1)))
hbox.show()
if __name__ == '__main__':
common.main(test)