PyGobject(五十二)布局容器之Paned

Gtk.Paned

Gtk.Paned分隔面板布局,有左右分隔和上下分隔两种。可拖动分隔线,来调整两个子孩子的大小

继承关系

Gtk.Paned是Gtk.Container的直接子类
这里写图片描述

Methods

方法修饰词方法名及参数
staticnew (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

NameTypeFlagsShort Description
max-positionintr/enLargest possible value for the “position” property
min-positionintr/enSmallest possible value for the “position” property
positionintr/w/enPosition of paned separator in pixels (0 means all the way to the left/top)
position-setboolr/w/enTrue if the Position property should be used
wide-handleboolr/w/enWhether the paned should have a prominent handle

Signals

NameShort Description
accept-positionThe ::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-positionThe ::cancel-position signal is a keybinding signal which gets emitted to cancel moving the position of the handle using key bindings.
cycle-child-focusThe ::cycle-child-focus signal is a keybinding signal which gets emitted to cycle the focus between the children of the paned.
cycle-handle-focusThe ::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-handleThe ::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-focusThe ::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()

代码解析:
例子比较简单,略





代码下载地址:http://download.csdn.net/detail/a87b01c14/9594728

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

sanxiaochengyu

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值