📜  PyGTK-窗口类

📅  最后修改于: 2020-11-08 07:46:03             🧑  作者: Mango


gtk.Window类的对象提供了一个小部件,用户通常将其视为Wwindow。该小部件是一个容器,因此,它可以容纳一个子小部件。它提供了一个显示有标题栏和调整大小控件的可显示区域。

gtk.Window类具有以下构造函数-

gtk.Window(type)

类型参数采用以下值之一-

gtk.WINDOW_TOPLEVEL (default) This window has no parent. The Toplevel windows are the main application window and dialogs.
gtk.WINDOW_POPUP This window has no frame or decorations. A popup window is used for menus and tooltips.

下面列出了gtk.Window类的一些重要方法-

S.NO Methods and Description
1

set_title(string)

This sets the “title” property of the gtk.window to the value specified by the title. The title of a window will be displayed in its title bar.

2

get_title()

This returns the title of a window if set.

3

set_position()

This sets the position of window. The predefined position
constants are −

  • gtk.WIN_POS_NONE

  • gtk.WIN_POS_CENTER

  • gtk.WIN_POS_MOUSE

  • gtk.WIN_POS_CENTER_ALWAYS

  • gtk.WIN_POS_CENTER_ON_PARENT

3

set_focus()

This sets the widget specified to be the focus widget for the window.

4

set_resizable()

This is true by default. set_resizable() helps the user to set the size of a window.

5

set_decorated()

This is true by default. If false, the title bar and the resizing controls of window will be disabled.

6

set_modal()

If true, window becomes modal and the interaction with other windows is prevented. This is used for the Dialog widgets.

7

set_default_size()

This sets the default size of the window to the specified width and height in pixels.

gtk.Window小部件发出以下信号-

activate-default This is emitted when the default child widget of window is activated usually by the user pressing the Return or Enter key.
activate-focus This is emitted when the child widget with the focus is activated usually by the user pressing the Space key.
move-focus This is emitted when the focus is changed within the window’s child widgets when the user presses the Tab, the Shift+Tab or the Up, Down, Left or Right arrow keys.
set-focus This is emitted when the focus changes to widget in window.