Gtk.Paned
Gtk.Paned分隔面板布局,有左右分隔和上下分隔两种。可拖动分隔线,来调整两个子孩子的大小
继承关系
Gtk.Paned是Gtk.Container的直接子类
Methods
方法修饰词 | 方法名及参数 |
---|---|
static | new (orientation) |
add1 (child) | |
add2 (child) | |
get_child1 () | |
get_child2 () | |
get_handle_window () | |
get_position () | |
get_wide_handle () | |
pack1 (child, resize, shrink) | |
pack2 (child, resize, shrink) | |
set_position (position) | |
set_wide_handle (wide) |
Virtual Methods
do_accept_position () |
do_cancel_position () |
do_cycle_child_focus (reverse) |
do_cycle_handle_focus (reverse) |
do_move_handle (scroll) |
do_toggle_handle_focus () |
Properties
Name | Type | Flags | Short Description |
---|---|---|---|
max-position | int | r/en | Largest possible value for the “position” property |
min-position | int | r/en | Smallest possible value for the “position” property |
position | int | r/w/en | Position of paned separator in pixels (0 means all the way to the left/top) |
position-set | bool | r/w/en | True if the Position property should be used |
wide-handle | bool | r/w/en | Whether the paned should have a prominent handle |
Signals
Name | Short Description |
---|---|
accept-position | The ::accept-position signal is a keybinding signal which gets emitted to accept the current position of the handle when moving it using key bindings. |
cancel-position | The ::cancel-position signal is a keybinding signal which gets emitted to cancel moving the position of the handle using key bindings. |
cycle-child-focus | The ::cycle-child-focus signal is a keybinding signal which gets emitted to cycle the focus between the children of the paned. |
cycle-handle-focus | The ::cycle-handle-focus signal is a keybinding signal which gets emitted to cycle whether the paned should grab focus to allow the user to change position of the handle by using key bindings. |
move-handle | The ::move-handle signal is a keybinding signal which gets emitted to move the handle when the user is using key bindings to move it. |
toggle-handle-focus | The ::toggle-handle-focus is a keybinding signal which gets emitted to accept the current position of the handle and then move focus to the next widget in the focus chain. |
例子
代码:
#!/usr/bin/env python3
# Created by xiaosanyu at 16/7/7
# section 069
TITLE = "Paned"
DESCRIPTION = """
Gtk.Paned has two panes, arranged either horizontally or vertically.
The division between the two panes is adjustable by the user by dragging a handle.
"""
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk
class PanedWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title="Paned Example")
self.set_size_request(250, 200)
hpaned = Gtk.Paned(orientation=Gtk.Orientation.HORIZONTAL)
hpaned.add1(Gtk.Button("button1"))
hpaned.add2(Gtk.Button("button2"))
vpaned = Gtk.Paned(orientation=Gtk.Orientation.VERTICAL)
vpaned.add1(hpaned)
vpaned.add2(Gtk.Button("button3"))
self.add(vpaned)
def main():
win = PanedWindow()
win.connect("delete-event", Gtk.main_quit)
win.show_all()
Gtk.main()
if __name__ == "__main__":
main()
代码解析:
例子比较简单,略