sugar-toolkit-gtk3/examples/notebook.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

33 lines
648 B
Python

from gi.repository import Gtk
from sugar3.graphics.notebook import Notebook
from common import set_theme
set_theme()
w = Gtk.Window()
w.connect("delete-event", Gtk.main_quit)
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
w.add(box)
nb = Notebook(can_close_tabs=True)
box.pack_start(nb, False, False, 0)
for i in range(5):
bufferf = "Prepend Frame %d" % (i + 1)
bufferl = "PPage %d" % (i + 1)
frame = Gtk.Frame()
frame.set_border_width(10)
frame.set_size_request(100, 75)
label = Gtk.Label(bufferf)
frame.add(label)
label.show()
nb.add_page(bufferl, frame)
frame.show()
w.show_all()
Gtk.main()