diff --git a/stack.py b/stack.py new file mode 100755 index 0000000..e3dec57 --- /dev/null +++ b/stack.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 + +import gi +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk + +class MyWindow(Gtk.Window): + + def __init__(self): + Gtk.Window.__init__(self, title = "Hello World!") + + self.box = Gtk.Box(orientation = Gtk.Orientation.VERTICAL, spacing = 6) + self.add(self.box) + + stack = Gtk.Stack() + stack.set_transition_type(Gtk.StackTransitionType.SLIDE_LEFT_RIGHT) + stack.set_transition_duration(1000) + + checkbutton = Gtk.CheckButton("Click me!") + stack.add_titled(checkbutton, "check", "CheckButton") + + label = Gtk.Label() + label.set_markup("A fancy label") + stack.add_titled(label, "label", "Label") + + stack_switcher = Gtk.StackSwitcher() + stack_switcher.set_stack(stack) + self.box.pack_start(stack_switcher, True, True, 0) + self.box.pack_start(stack, True, True, 0) + +window = MyWindow() +window.connect("delete-event", Gtk.main_quit) +window.show_all() + +Gtk.main()