PyGobject(三十二)布局容器之Window

Gtk.Window

Gtk.Window是一个可以包含其他部件一个顶层窗口。允许用户操作窗口(调整其大小,移动它,关闭它,…)

继承关系

Gtk.Window是Gtk.Bin的直接子类
这里写图片描述
这里写图片描述

Methods

方法修饰词方法名及参数
staticget_default_icon_list ()
staticget_default_icon_name ()
staticlist_toplevels ()
staticnew (type)
staticset_auto_startup_notification (setting)
staticset_default_icon (icon)
staticset_default_icon_from_file (filename)
staticset_default_icon_list (list)
staticset_default_icon_name (name)
staticset_interactive_debugging (enable)
activate_default ()
activate_focus ()
activate_key (event)
add_accel_group (accel_group)
add_mnemonic (keyval, target)
begin_move_drag (button, root_x, root_y, timestamp)
begin_resize_drag (edge, button, root_x, root_y, timestamp)
close ()
deiconify ()
fullscreen ()
fullscreen_on_monitor (screen, monitor)
get_accept_focus ()
get_application ()
get_attached_to ()
get_decorated ()
get_default_size ()
get_default_widget ()
get_deletable ()
get_destroy_with_parent ()
get_focus ()
get_focus_on_map ()
get_focus_visible ()
get_gravity ()
get_group ()
get_has_resize_grip ()
get_hide_titlebar_when_maximized ()
get_icon ()
get_icon_list ()
get_icon_name ()
get_mnemonic_modifier ()
get_mnemonics_visible ()
get_modal ()
get_opacity ()
get_position ()
get_resizable ()
get_resize_grip_area ()
get_role ()
get_screen ()
get_size ()
get_skip_pager_hint ()
get_skip_taskbar_hint ()
get_title ()
get_titlebar ()
get_transient_for ()
get_type_hint ()
get_urgency_hint ()
get_window_type ()
has_group ()
has_toplevel_focus ()
iconify ()
is_active ()
is_maximized ()
maximize ()
mnemonic_activate (keyval, modifier)
move (x, y)
parse_geometry (geometry)
present ()
present_with_time (timestamp)
propagate_key_event (event)
remove_accel_group (accel_group)
remove_mnemonic (keyval, target)
reshow_with_initial_size ()
resize (width, height)
resize_grip_is_visible ()
resize_to_geometry (width, height)
set_accept_focus (setting)
set_application (application)
set_attached_to (attach_widget)
set_decorated (setting)
set_default (default_widget)
set_default_geometry (width, height)
set_default_size (width, height)
set_deletable (setting)
set_destroy_with_parent (setting)
set_focus (focus)
set_focus_on_map (setting)
set_focus_visible (setting)
set_geometry_hints (geometry_widget, geometry, geom_mask)
set_gravity (gravity)
set_has_resize_grip (value)
set_has_user_ref_count (setting)
set_hide_titlebar_when_maximized (setting)
set_icon (icon)
set_icon_from_file (filename)
set_icon_list (list)
set_icon_name (name)
set_keep_above (setting)
set_keep_below (setting)
set_mnemonic_modifier (modifier)
set_mnemonics_visible (setting)
set_modal (modal)
set_opacity (opacity)
set_position (position)
set_resizable (resizable)
set_role (role)
set_screen (screen)
set_skip_pager_hint (setting)
set_skip_taskbar_hint (setting)
set_startup_id (startup_id)
set_title (title)
set_titlebar (titlebar)
set_transient_for (parent)
set_type_hint (hint)
set_urgency_hint (setting)
set_wmclass (wmclass_name, wmclass_class)
stick ()
unfullscreen ()
unmaximize ()
unstick ()

static get_default_icon_list ()

获取由Gtk.Window.set_default_icon_list()设置的值.一次性设置所有窗口的默认图标,包含各种分辨率的图标

static get_default_icon_name ()

获取由Gtk.Window.set_default_icon_name,默认图标的名称

static list_toplevels ()

获取已经存在的顶层窗口列表

static new (type)

    Parameters: type (Gtk.WindowType) – 窗口类型

static set_auto_startup_notification (setting)


static set_default_icon (icon)

设置应用程序的默认图标,目前发现在Gtk.AboutDialog中有用到

static set_default_icon_from_file (filename)

作用同上,不过这个是从给定的路径中加载图片

static set_default_icon_list (list)

设置图标列表,包含各种分辨率的

static set_default_icon_name (name)

设置默认图标名称

static set_interactive_debugging (enable)

显示交互式的Debug界面
这里写图片描述
这里写图片描述

activate_default ()

激活窗口中的默认部件,如果成功返回True

activate_focus ()

激活窗口中获得焦点的部件,如果成功返回True

activate_key (event)

如果一个助记符或者绑定的快捷键被发现,返回True

add_accel_group (accel_group)

    Parameters: accel_group (Gtk.AccelGroup) – a Gtk.AccelGroup
添加快捷键组
参见PyGobject(五十九)布局容器之Menu例三

add_mnemonic (keyval, target)

    Parameters:
       keyval (int) – 助记符
       target (Gtk.Widget) – 绑定的部件
添加助记符

begin_move_drag (button, root_x, root_y, timestamp)

开始拖动窗口

begin_resize_drag (edge, button, root_x, root_y, timestamp)

开始调整窗口大小

close ()

关闭窗口

deiconify ()

取消窗口图标化

fullscreen ()

全屏

fullscreen_on_monitor (screen, monitor)

在指定的一个显示器上全屏

get_accept_focus ()

设置窗口是否可以获得输入焦点

get_application ()

获取窗口所绑定的Gtk.Application

get_attached_to ()

获取窗口所依附的部件

get_decorated ()

获取窗口是使用titlebar来装饰窗口

get_default_size ()

获取窗口默认大小

get_default_widget ()

获取默认部件

get_deletable ()

获取是否已经取消关闭按钮

get_destroy_with_parent ()

获取是否允许当父窗口销毁时自动销毁自己

get_focus ()

获取当前窗口获得焦点的部件

get_focus_on_map ()

当窗口映射后,窗口是否获得能够获得输入焦点

get_focus_visible ()

是否显示焦点矩形框

get_gravity ()


get_group ()


get_has_resize_grip ()

Deprecated

get_hide_titlebar_when_maximized ()

当最大化时是否隐藏titlebar

get_icon ()

获取图标

get_icon_list ()

获取图标列表

get_icon_name ()

获取图标名称

get_mnemonic_modifier ()


get_mnemonics_visible ()

助记符是否可见

get_modal ()


get_opacity ()

获取窗口透明度

get_position ()

获取窗口位置

get_resizable ()

获取是否可调整窗口大小

get_resize_grip_area ()


get_role ()


get_screen ()


get_size ()

获取窗口宽高

get_skip_pager_hint ()


get_skip_taskbar_hint ()


get_title ()

获取标题

get_titlebar ()

获取titlebar

get_transient_for ()


get_type_hint ()


get_urgency_hint ()


get_window_type ()

获取窗口类型

has_group ()


has_toplevel_focus ()

iconify ()

只显示图片,不显示窗口

is_active ()

窗口是否激活

is_maximized ()

窗口是否已经最大化

maximize ()

窗口最大化

mnemonic_activate (keyval, modifier)


move (x, y)

将窗口移动到某个位置

parse_geometry (geometry)


present ()

显示窗口

present_with_time (timestamp)


propagate_key_event (event)


remove_accel_group (accel_group)

移除快捷键组

remove_mnemonic (keyval, target)

移除部件的助记符

reshow_with_initial_size ()


resize (width, height)

调整窗口大小

resize_grip_is_visible ()


resize_to_geometry (width, height)


set_accept_focus (setting)


set_application (application)


set_attached_to (attach_widget)


set_decorated (setting)

默认使用titlebar装饰窗口,包括最大化最小化。
如果设置False,则不显示

set_default (default_widget)

设置默认部件

set_default_geometry (width, height)

Deprecated ,使用set_default_size代替

set_default_size (width, height)

设置窗口的固定大小

set_deletable (setting)

在某些窗口管理系统中取消关闭按钮

set_destroy_with_parent (setting)

当父窗口销毁时,自己是否销毁,常用在Dialog中

set_focus (focus)

设置获取焦点的部件

set_focus_on_map (setting)


set_focus_visible (setting)


set_geometry_hints (geometry_widget, geometry, geom_mask)


set_gravity (gravity)


set_has_resize_grip (value)


set_has_user_ref_count (setting)


set_hide_titlebar_when_maximized (setting)

当最大化的时候,是否隐藏titlebar

set_icon (icon)

设置图标

set_icon_from_file (filename)

设置图标,已给定的文件路径

set_icon_list (list)

设置图标列表

set_icon_name (name)

设置图标名称

set_keep_above (setting)

窗口置顶,永远显示在其他窗口之上

set_keep_below (setting)

窗口在其它窗口之下

set_mnemonic_modifier (modifier)


set_mnemonics_visible (setting)


set_modal (modal)


set_opacity (opacity)

设置透明度

set_position (position)


set_resizable (resizable)

设置是否可调整大小

set_role (role)


set_screen (screen)


set_skip_pager_hint (setting)


set_skip_taskbar_hint (setting)


set_startup_id (startup_id)


set_title (title)

设置标题

set_titlebar (titlebar)

设置Titlebar

set_transient_for (parent)


set_type_hint (hint)


set_urgency_hint (setting)


set_wmclass (wmclass_name, wmclass_class)


stick ()


unfullscreen ()

取消全屏

unmaximize ()

取消最大化

unstick ()


Virtual Methods

do_activate_default ()
do_activate_focus ()
do_enable_debugging (toggle)
do_keys_changed ()
do_set_focus (focus)

Properties

NameTypeFlagsShort Description
accept-focusboolr/w/enTrue if the window should receive the input focus.
applicationGtk.Applicationr/w/enThe Gtk.Application for the window
attached-toGtk.Widgetr/w/c/enThe widget where the window is attached
decoratedboolr/w/enWhether the window should be decorated by the window manager
default-heightintr/w/enThe default height of the window, used when initially showing the window
default-widthintr/w/enThe default width of the window, used when initially showing the window
deletableboolr/w/enWhether the window frame should have a close button
destroy-with-parentboolr/w/enIf this window should be destroyed when the parent is destroyed
focus-on-mapboolr/w/enTrue if the window should receive the input focus when mapped.
focus-visibleboolr/w/enWhether focus rectangles are currently visible in this window
gravityGdk.Gravityr/w/enThe window gravity of the window
has-resize-gripboold/r/w/enSpecifies whether the window should have a resize grip deprecated
has-toplevel-focusboolrWhether the input focus is within this Gtk.Window
hide-titlebar-when-maximizedboolr/w/enIf this window’s titlebar should be hidden when the window is maximized
iconGdkPixbuf.Pixbufr/w/enIcon for this window
icon-namestrr/w/enName of the themed icon for this window
is-activeboolrWhether the toplevel is the current active window
is-maximizedboolrWhether the window is maximized
mnemonics-visibleboolr/w/enWhether mnemonics are currently visible in this window
modalboolr/w/enIf True, the window is modal (other windows are not usable while this one is up)
resizableboolr/w/enIf True, users can resize the window
resize-grip-visibleboold/rSpecifies whether the window’s resize grip is visible. deprecated
rolestrr/wUnique identifier for the window to be used when restoring a session
screenGdk.Screenr/w/enThe screen where this window will be displayed
skip-pager-hintboolr/w/enTrue if the window should not be in the pager.
skip-taskbar-hintboolr/w/enTrue if the window should not be in the task bar.
startup-idstrwUnique startup identifier for the window used by startup-notification
titlestrr/wThe title of the window
transient-forGtk.Windowr/w/c/enThe transient parent of the dialog
typeGtk.WindowTyper/w/coThe type of the window
type-hintGdk.WindowTypeHintr/w/enHint to help the desktop environment understand what kind of window this is and how to treat it.
urgency-hintboolr/w/enTrue if the window should be brought to the user’s attention.
window-positionGtk.WindowPositionr/w/enThe initial position of the window

Signals

NameShort Description
activate-defaultThe ::activate-default signal is a keybinding signal which gets emitted when the user activates the default widget of window.
activate-focusThe ::activate-focus signal is a keybinding signal which gets emitted when the user activates the currently focused widget of window.
enable-debuggingThe ::enable-debugging signal is a keybinding signal which gets emitted when the user enables or disables interactive debugging.
keys-changedThe ::keys-changed signal gets emitted when the set of accelerators or mnemonics that are associated with window changes.
set-focus

附录

Gtk.WindowType

class Gtk.WindowType
Bases: GObject.GEnum

设置窗口的类型,一般来说,窗口都是作为一个顶层窗口来呈现的。在某些特殊的情景(如在菜单中),才会作为一个气泡提示框等

TOPLEVEL = 0

顶层窗口

POPUP = 1

气泡提示框





代码下载地址:http://download.youkuaiyun.com/detail/a87b01c14/9594728

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

sanxiaochengyu

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

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

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

打赏作者

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

抵扣说明:

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

余额充值