add stack.py
This commit is contained in:
parent
bf60684927
commit
57ce0ab726
35
stack.py
Executable file
35
stack.py
Executable file
@ -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("<big>A fancy label</big>")
|
||||
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()
|
Loading…
x
Reference in New Issue
Block a user