本文整理汇总了Python中gi.repository.Gtk.StackSwitcher方法的典型用法代码示例。如果您正苦于以下问题:Python Gtk.StackSwitcher方法的具体用法?Python Gtk.StackSwitcher怎么用?Python Gtk.StackSwitcher使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gtk
的用法示例。
在下文中一共展示了Gtk.StackSwitcher方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_widget
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import StackSwitcher [as 别名]
def build_widget(self):
"""
Build the widget that contains the view, see
:class:`~gui.views.pageview.PageView
"""
container = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
container.set_border_width(12)
self.header = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
self.header.show()
self.stack = Gtk.Stack()
ss = Gtk.StackSwitcher()
ss.set_stack(self.stack)
self.stack.show()
ss.show()
container.set_spacing(6)
container.pack_start(self.header, False, False, 0)
container.pack_start(Gtk.Separator(), False, False, 0)
container.pack_start(ss, False, False, 0)
container.pack_start(self.stack, True, True, 0)
container.show_all()
return container
示例2: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import StackSwitcher [as 别名]
def __init__(self):
Gtk.Window.__init__(self)
self.set_transient_for(Window.get_default())
self.set_position(Gtk.WindowPosition.CENTER_ON_PARENT)
self.set_size_request(600, 600)
self.set_title(_("Settings"))
self.resize(600, 600)
self.stack_switcher = Gtk.StackSwitcher()
self.stack = Gtk.Stack()
self._build_widgets()
示例3: on_screen_stack_children_changed
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import StackSwitcher [as 别名]
def on_screen_stack_children_changed(self, stack, child):
if len(self.screen_stack.get_children()) > 1:
# Display the StackSwitcher
self.header_bar.set_custom_title(self.stack_switcher)
else:
# Display the Title / Subtitle
self.header_bar.set_custom_title(None)
示例4: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import StackSwitcher [as 别名]
def __init__(self, is_beta, wants_csd, **kwargs):
super().__init__(**kwargs)
if wants_csd:
header_bar = Gtk.HeaderBar(visible=True, title=_("Preferences"), \
show_close_button=True)
self.set_titlebar(header_bar)
stack_switcher = Gtk.StackSwitcher(visible=True, stack=self.stack, \
halign=Gtk.Align.CENTER)
header_bar.set_custom_title(stack_switcher)
self.set_default_size(480, 500)
else:
stack_sidebar = Gtk.StackSidebar(visible=True, stack=self.stack)
stack_sidebar.set_size_request(140, -1)
self.content_area.pack_start(stack_sidebar, False, False, 0)
self.set_default_size(600, 400) # Not high enough but the golden
# ratio is more important than usability
self.page_builder_images()
self.page_builder_tools()
self.page_builder_advanced(is_beta)
# Each page_* attribute is a GtkGrid. The page_builder_* methods declare
# their grid to be the currently filled one, and reset the counter.
# Then, the page_builder_* methods will call the add_* methods, who will
# build accurate widgets to be packed on the grid by the attach_* methods.
############################################################################