- GtkWindow
- 继承关系
- Methods
-
-
- static get_default_icon_list
- static get_default_icon_name
- static new type
- static set_auto_startup_notification setting
- static set_default_icon icon
- static set_default_icon_from_file filename
- static set_default_icon_list list
- static set_default_icon_name name
- static set_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
-
-
- Virtual Methods
- Properties
- Signals
- 附录
Gtk.Window
Gtk.Window是一个可以包含其他部件一个顶层窗口。允许用户操作窗口(调整其大小,移动它,关闭它,…)
继承关系
Gtk.Window是Gtk.Bin的直接子类
Methods
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
Name | Type | Flags | Short Description |
---|---|---|---|
accept-focus | bool | r/w/en | True if the window should receive the input focus. |
application | Gtk.Application | r/w/en | The Gtk.Application for the window |
attached-to | Gtk.Widget | r/w/c/en | The widget where the window is attached |
decorated | bool | r/w/en | Whether the window should be decorated by the window manager |
default-height | int | r/w/en | The default height of the window, used when initially showing the window |
default-width | int | r/w/en | The default width of the window, used when initially showing the window |
deletable | bool | r/w/en | Whether the window frame should have a close button |
destroy-with-parent | bool | r/w/en | If this window should be destroyed when the parent is destroyed |
focus-on-map | bool | r/w/en | True if the window should receive the input focus when mapped. |
focus-visible | bool | r/w/en | Whether focus rectangles are currently visible in this window |
gravity | Gdk.Gravity | r/w/en | The window gravity of the window |
has-resize-grip | bool | d/r/w/en | Specifies whether the window should have a resize grip deprecated |
has-toplevel-focus | bool | r | Whether the input focus is within this Gtk.Window |
hide-titlebar-when-maximized | bool | r/w/en | If this window’s titlebar should be hidden when the window is maximized |
icon | GdkPixbuf.Pixbuf | r/w/en | Icon for this window |
icon-name | str | r/w/en | Name of the themed icon for this window |
is-active | bool | r | Whether the toplevel is the current active window |
is-maximized | bool | r | Whether the window is maximized |
mnemonics-visible | bool | r/w/en | Whether mnemonics are currently visible in this window |
modal | bool | r/w/en | If True, the window is modal (other windows are not usable while this one is up) |
resizable | bool | r/w/en | If True, users can resize the window |
resize-grip-visible | bool | d/r | Specifies whether the window’s resize grip is visible. deprecated |
role | str | r/w | Unique identifier for the window to be used when restoring a session |
screen | Gdk.Screen | r/w/en | The screen where this window will be displayed |
skip-pager-hint | bool | r/w/en | True if the window should not be in the pager. |
skip-taskbar-hint | bool | r/w/en | True if the window should not be in the task bar. |
startup-id | str | w | Unique startup identifier for the window used by startup-notification |
title | str | r/w | The title of the window |
transient-for | Gtk.Window | r/w/c/en | The transient parent of the dialog |
type | Gtk.WindowType | r/w/co | The type of the window |
type-hint | Gdk.WindowTypeHint | r/w/en | Hint to help the desktop environment understand what kind of window this is and how to treat it. |
urgency-hint | bool | r/w/en | True if the window should be brought to the user’s attention. |
window-position | Gtk.WindowPosition | r/w/en | The initial position of the window |
Signals
Name | Short Description |
---|---|
activate-default | The ::activate-default signal is a keybinding signal which gets emitted when the user activates the default widget of window. |
activate-focus | The ::activate-focus signal is a keybinding signal which gets emitted when the user activates the currently focused widget of window. |
enable-debugging | The ::enable-debugging signal is a keybinding signal which gets emitted when the user enables or disables interactive debugging. |
keys-changed | The ::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