Gtk.Widget¶
Methods¶
| Inherited: | GObject.Object (37), Gtk.Buildable (10) | 
|---|---|
| Structs: | Gtk.WidgetClass (12), GObject.ObjectClass (5) | 
Virtual Methods¶
| Inherited: | GObject.Object (7), Gtk.Buildable (10) | 
|---|
Properties¶
| Name | Type | Flags | Short Description | 
|---|---|---|---|
| app-paintable | bool | r/w/en | Whether the application will paint directly on the widget | 
| can-default | bool | r/w/en | Whether the widget can be the default widget | 
| can-focus | bool | r/w/en | Whether the widget can accept the input focus | 
| composite-child | bool | r | Whether the widget is part of a composite widget | 
| double-buffered | bool | d/r/w/en | Whether the widget is double buffered deprecated | 
| events | Gdk.EventMask | r/w/en | The event mask that decides what kind of GdkEvents this widget gets | 
| expand | bool | r/w | Whether widget wants to expand in both directions | 
| focus-on-click | bool | r/w/en | Whether the widget should grab focus when it is clicked with the mouse | 
| halign | Gtk.Align | r/w/en | How to position in extra horizontal space | 
| has-default | bool | r/w/en | Whether the widget is the default widget | 
| has-focus | bool | r/w/en | Whether the widget has the input focus | 
| has-tooltip | bool | r/w/en | Whether this widget has a tooltip | 
| height-request | int | r/w/en | Override for height request of the widget, or -1 if natural request should be used | 
| hexpand | bool | r/w/en | Whether widget wants more horizontal space | 
| hexpand-set | bool | r/w/en | Whether to use the hexpand property | 
| is-focus | bool | r/w | Whether the widget is the focus widget within the toplevel | 
| margin | int | r/w | Pixels of extra space on all four sides | 
| margin-bottom | int | r/w/en | Pixels of extra space on the bottom side | 
| margin-end | int | r/w/en | Pixels of extra space on the end | 
| margin-left | int | d/r/w/en | Pixels of extra space on the left side deprecated | 
| margin-right | int | d/r/w/en | Pixels of extra space on the right side deprecated | 
| margin-start | int | r/w/en | Pixels of extra space on the start | 
| margin-top | int | r/w/en | Pixels of extra space on the top side | 
| name | str | r/w | The name of the widget | 
| no-show-all | bool | r/w/en | Whether Gtk.Widget.show_all() should not affect this widget | 
| opacity | float | r/w/en | The opacity of the widget, from 0 to 1 | 
| parent | Gtk.Container | r/w | The parent widget of this widget. Must be a Container widget | 
| receives-default | bool | r/w/en | If True, the widget will receive the default action when it is focused | 
| scale-factor | int | r | The scaling factor of the window | 
| sensitive | bool | r/w/en | Whether the widget responds to input | 
| style | Gtk.Style | d/r/w | The style of the widget, which contains information about how it will look (colors etc) deprecated | 
| tooltip-markup | str | r/w | The contents of the tooltip for this widget | 
| tooltip-text | str | r/w | The contents of the tooltip for this widget | 
| valign | Gtk.Align | r/w/en | How to position in extra vertical space | 
| vexpand | bool | r/w/en | Whether widget wants more vertical space | 
| vexpand-set | bool | r/w/en | Whether to use the vexpand property | 
| visible | bool | r/w/en | Whether the widget is visible | 
| width-request | int | r/w/en | Override for width request of the widget, or -1 if natural request should be used | 
| window | Gdk.Window | r | The widget’s window if it is realized | 
Style Properties¶
| Name | Type | Default | Flags | Short Description | 
|---|---|---|---|---|
| cursor-aspect-ratio | float | 0.03999999910593033 | r | Aspect ratio with which to draw insertion cursor | 
| cursor-color | Gdk.Color | None | d/r | Color with which to draw insertion cursor deprecated | 
| focus-line-pattern | str | '\x01\x01' | d/r | Dash pattern used to draw the focus indicator. The character values are interpreted as pixel widths of alternating on and off segments of the line. deprecated | 
| focus-line-width | int | 1 | d/r | Width, in pixels, of the focus indicator line deprecated | 
| focus-padding | int | 1 | d/r | Width, in pixels, between focus indicator and the widget ‘box’ deprecated | 
| interior-focus | bool | True | d/r | Whether to draw the focus indicator inside widgets deprecated | 
| link-color | Gdk.Color | None | d/r | Color of unvisited links deprecated | 
| scroll-arrow-hlength | int | 16 | r | The length of horizontal scroll arrows | 
| scroll-arrow-vlength | int | 16 | r | The length of vertical scroll arrows | 
| secondary-cursor-color | Gdk.Color | None | d/r | Color with which to draw the secondary insertion cursor when editing mixed right-to-left and left-to-right text deprecated | 
| separator-height | int | 0 | d/r | The height of separators if “wide-separators” is Truedeprecated | 
| separator-width | int | 0 | d/r | The width of separators if wide-separators is Truedeprecated | 
| text-handle-height | int | 20 | r | Height of text selection handles | 
| text-handle-width | int | 16 | r | Width of text selection handles | 
| visited-link-color | Gdk.Color | None | d/r | Color of visited links deprecated | 
| wide-separators | bool | False | d/r | Whether separators have configurable width and should be drawn using a box instead of a line deprecated | 
| window-dragging | bool | False | r | Whether windows can be dragged and maximized by clicking on empty areas | 
Signals¶
| Inherited: | GObject.Object (1) | 
|---|
| Name | Short Description | 
|---|---|
| accel-closures-changed | |
| button-press-event | The ::button-press-eventsignal will be emitted when a button (typically from a mouse) is pressed. | 
| button-release-event | The ::button-release-eventsignal will be emitted when a button (typically from a mouse) is released. | 
| can-activate-accel | Determines whether an accelerator that activates the signal identified by signal_id can currently be activated. | 
| child-notify | The ::child-notifysignal is emitted for each ‘child property [child-properties]’  that has changed on an object. | 
| composited-changed | The ::composited-changedsignal is emitted when the composited status of widgets screen changes.deprecated | 
| configure-event | The ::configure-eventsignal will be emitted when the size, position or stacking of the widget’s window has changed. | 
| damage-event | Emitted when a redirected window belonging to widget gets drawn into. | 
| delete-event | The ::delete-eventsignal is emitted if a user requests that a toplevel window is closed. | 
| destroy | Signals that all holders of a reference to the widget should release the reference that they hold. | 
| destroy-event | The ::destroy-eventsignal is emitted when aGdk.Windowis destroyed. | 
| direction-changed | The ::direction-changedsignal is emitted when the text direction of a widget changes. | 
| drag-begin | The ::drag-beginsignal is emitted on the drag source when a drag is started. | 
| drag-data-delete | The ::drag-data-deletesignal is emitted on the drag source when a drag with the actionGdk.DragAction.MOVEis successfully completed. | 
| drag-data-get | The ::drag-data-getsignal is emitted on the drag source when the drop site requests the data which is dragged. | 
| drag-data-received | The ::drag-data-receivedsignal is emitted on the drop site when the dragged data has been received. | 
| drag-drop | The ::drag-dropsignal is emitted on the drop site when the user drops the data onto the widget. | 
| drag-end | The ::drag-endsignal is emitted on the drag source when a drag is finished. | 
| drag-failed | The ::drag-failedsignal is emitted on the drag source when a drag has failed. | 
| drag-leave | The ::drag-leavesignal is emitted on the drop site when the cursor leaves the widget. | 
| drag-motion | The ::drag-motionsignal is emitted on the drop site when the user moves the cursor over the widget during a drag. | 
| draw | This signal is emitted when a widget is supposed to render itself. | 
| enter-notify-event | The ::enter-notify-eventwill be emitted when the pointer enters the widget’s window. | 
| event | The GTK+ main loop will emit three signals for each GDK event delivered to a widget: one generic ::eventsignal, another, more specific, signal that matches the type of event delivered (e.g. | 
| event-after | After the emission of the Gtk.Widget::eventsignal and (optionally) the second more specific signal,::event-afterwill be emitted regardless of the previous two signals handlers return values. | 
| focus | |
| focus-in-event | The ::focus-in-eventsignal will be emitted when the keyboard focus enters the widget’s window. | 
| focus-out-event | The ::focus-out-eventsignal will be emitted when the keyboard focus leaves the widget’s window. | 
| grab-broken-event | Emitted when a pointer or keyboard grab on a window belonging to widget gets broken. | 
| grab-focus | |
| grab-notify | The ::grab-notifysignal is emitted when a widget becomes shadowed by a GTK+ grab (not a pointer or keyboard grab) on another widget, or when it becomes unshadowed due to a grab being removed. | 
| hide | The ::hidesignal is emitted when widget is hidden, for example withGtk.Widget.hide(). | 
| hierarchy-changed | The ::hierarchy-changedsignal is emitted when the anchored state of a widget changes. | 
| key-press-event | The ::key-press-eventsignal is emitted when a key is pressed. | 
| key-release-event | The ::key-release-eventsignal is emitted when a key is released. | 
| keynav-failed | Gets emitted if keyboard navigation fails. | 
| leave-notify-event | The ::leave-notify-eventwill be emitted when the pointer leaves the widget’s window. | 
| map | The ::mapsignal is emitted when widget is going to be mapped, that is when the widget is visible (which is controlled withGtk.Widget.set_visible()) and all its parents up to the toplevel widget are also visible. | 
| map-event | The ::map-eventsignal will be emitted when the widget’s window is mapped. | 
| mnemonic-activate | The default handler for this signal activates widget if group_cycling is False, or just makes widget grab focus if group_cycling isTrue. | 
| motion-notify-event | The ::motion-notify-eventsignal is emitted when the pointer moves over the widget’sGdk.Window. | 
| move-focus | |
| parent-set | The ::parent-setsignal is emitted when a new parent has been set on a widget. | 
| popup-menu | This signal gets emitted whenever a widget should pop up a context menu. | 
| property-notify-event | The ::property-notify-eventsignal will be emitted when a property on the widget’s window has been changed or deleted. | 
| proximity-in-event | To receive this signal the Gdk.Windowassociated to the widget needs to enable theGdk.EventMask.PROXIMITY_IN_MASKmask. | 
| proximity-out-event | To receive this signal the Gdk.Windowassociated to the widget needs to enable theGdk.EventMask.PROXIMITY_OUT_MASKmask. | 
| query-tooltip | Emitted when Gtk.Widget:has-tooltipisTrueand the hover timeout has expired with the cursor hovering “above” widget; or emitted when widget got focus in keyboard mode. | 
| realize | The ::realizesignal is emitted when widget is associated with aGdk.Window, which means thatGtk.Widget.realize() has been called or the widget has been mapped (that is, it is going to be drawn). | 
| screen-changed | The ::screen-changedsignal gets emitted when the screen of a widget has changed. | 
| scroll-event | The ::scroll-eventsignal is emitted when a button in the 4 to 7 range is pressed. | 
| selection-clear-event | The ::selection-clear-eventsignal will be emitted when the the widget’s window has lost ownership of a selection. | 
| selection-get | |
| selection-notify-event | |
| selection-received | |
| selection-request-event | The ::selection-request-eventsignal will be emitted when another client requests ownership of the selection owned by the widget’s window. | 
| show | The ::showsignal is emitted when widget is shown, for example withGtk.Widget.show(). | 
| show-help | |
| size-allocate | |
| state-changed | The ::state-changedsignal is emitted when the widget state changes.deprecated | 
| state-flags-changed | The ::state-flags-changedsignal is emitted when the widget state changes, seeGtk.Widget.get_state_flags(). | 
| style-set | The ::style-setsignal is emitted when a new style has been set on a widget.deprecated | 
| style-updated | The ::style-updatedsignal is a convenience signal that is emitted when theGtk.StyleContext::changedsignal is emitted on the widget’s associatedGtk.StyleContextas returned byGtk.Widget.get_style_context(). | 
| touch-event | |
| unmap | The ::unmapsignal is emitted when widget is going to be unmapped, which means that either it or any of its parents up to the toplevel widget have been set as hidden. | 
| unmap-event | The ::unmap-eventsignal will be emitted when the widget’s window is unmapped. | 
| unrealize | The ::unrealizesignal is emitted when theGdk.Windowassociated with widget is destroyed, which means thatGtk.Widget.unrealize() has been called or the widget has been unmapped (that is, it is going to be hidden). | 
| visibility-notify-event | The ::visibility-notify-eventwill be emitted when the widget’s window is obscured or unobscured.deprecated | 
| window-state-event | The ::window-state-eventwill be emitted when the state of the toplevel window associated to the widget changes. | 
Fields¶
| Inherited: | GObject.Object (1) | 
|---|
| Name | Type | Access | Description | 
|---|---|---|---|
| parent_instance | GObject.InitiallyUnowned | r | 
Class Details¶
- 
class Gtk.Widget(**kwargs)¶
- Bases: - GObject.InitiallyUnowned,- Atk.ImplementorIface,- Gtk.Buildable- Abstract: - Yes - Structure: - Gtk.WidgetClass- Gtk.Widgetis the base class all widgets in GTK+ derive from. It manages the widget lifecycle, states and style.- Height-for-width Geometry Management
 - GTK+ uses a height-for-width (and width-for-height) geometry management system. Height-for-width means that a widget can change how much vertical space it needs, depending on the amount of horizontal space that it is given (and similar for width-for-height). The most common example is a label that reflows to fill up the available width, wraps to fewer lines, and therefore needs less height. - Height-for-width geometry management is implemented in GTK+ by way of five virtual methods: - Gtk.Widget.do_get_request_mode()
- Gtk.Widget.do_get_preferred_width()
- Gtk.Widget.do_get_preferred_height()
- Gtk.Widget.do_get_preferred_height_for_width()
- Gtk.Widget.do_get_preferred_width_for_height()
- Gtk.Widget.do_get_preferred_height_and_baseline_for_width()
 - There are some important things to keep in mind when implementing height-for-width and when using it in container implementations. - The geometry management system will query a widget hierarchy in only one orientation at a time. When widgets are initially queried for their minimum sizes it is generally done in two initial passes in the - Gtk.SizeRequestModechosen by the toplevel.- For example, when queried in the normal - Gtk.SizeRequestMode.HEIGHT_FOR_WIDTHmode: First, the default minimum and natural width for each widget in the interface will be computed using- Gtk.Widget.get_preferred_width(). Because the preferred widths for each container depend on the preferred widths of their children, this information propagates up the hierarchy, and finally a minimum and natural width is determined for the entire toplevel. Next, the toplevel will use the minimum width to query for the minimum height contextual to that width using- Gtk.Widget.get_preferred_height_for_width(), which will also be a highly recursive operation. The minimum height for the minimum width is normally used to set the minimum size constraint on the toplevel (unless- Gtk.Window.set_geometry_hints() is explicitly used instead).- After the toplevel window has initially requested its size in both dimensions it can go on to allocate itself a reasonable size (or a size previously specified with - Gtk.Window.set_default_size()). During the recursive allocation process it’s important to note that request cycles will be recursively executed while container widgets allocate their children. Each container widget, once allocated a size, will go on to first share the space in one orientation among its children and then request each child’s height for its target allocated width or its width for allocated height, depending. In this way a- Gtk.Widgetwill typically be requested its size a number of times before actually being allocated a size. The size a widget is finally allocated can of course differ from the size it has requested. For this reason,- Gtk.Widgetcaches a small number of results to avoid re-querying for the same sizes in one allocation cycle.- See ‘GtkContainer’s geometry management section [container-geometry-management]’ to learn more about how height-for-width allocations are performed by container widgets. - If a widget does move content around to intelligently use up the allocated size then it must support the request in both - Gtk.SizeRequestModeseven if the widget in question only trades sizes in a single orientation.- For instance, a - Gtk.Labelthat does height-for-width word wrapping will not expect to have- Gtk.Widget.do_get_preferred_height() called because that call is specific to a width-for-height request. In this case the label must return the height required for its own minimum possible width. By following this rule any widget that handles height-for-width or width-for-height requests will always be allocated at least enough space to fit its own content.- Here are some examples of how a - Gtk.SizeRequestMode.HEIGHT_FOR_WIDTHwidget generally deals with width-for-height requests, for- Gtk.Widget.do_get_preferred_height() it will do:- static void foo_widget_get_preferred_height (GtkWidget *widget, gint *min_height, gint *nat_height) { if (i_am_in_height_for_width_mode) { gint min_width, nat_width; GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, &min_width, &nat_width); GTK_WIDGET_GET_CLASS (widget)->get_preferred_height_for_width (widget, min_width, min_height, nat_height); } else { ... some widgets do both. For instance, if a GtkLabel is rotated to 90 degrees it will return the minimum and natural height for the rotated label here. } } - And in - Gtk.Widget.do_get_preferred_width_for_height() it will simply return the minimum and natural width:- static void foo_widget_get_preferred_width_for_height (GtkWidget *widget, gint for_height, gint *min_width, gint *nat_width) { if (i_am_in_height_for_width_mode) { GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, min_width, nat_width); } else { ... again if a widget is sometimes operating in width-for-height mode (like a rotated GtkLabel) it can go ahead and do its real width for height calculation here. } } - Often a widget needs to get its own request during size request or allocation. For example, when computing height it may need to also compute width. Or when deciding how to use an allocation, the widget may need to know its natural size. In these cases, the widget should be careful to call its virtual methods directly, like this: - GTK_WIDGET_GET_CLASS(widget)->get_preferred_width (widget, &min, &natural); - It will not work to use the wrapper functions, such as - Gtk.Widget.get_preferred_width() inside your own size request implementation. These return a request adjusted by- Gtk.SizeGroupand by the- Gtk.Widget.do_adjust_size_request() virtual method. If a widget used the wrappers inside its virtual method implementations, then the adjustments (such as widget margins) would be applied twice. GTK+ therefore does not allow this and will warn if you try to do it.- Of course if you are getting the size request for another widget, such as a child of a container, you must use the wrapper APIs. Otherwise, you would not properly consider widget margins, - Gtk.SizeGroup, and so forth.- Since 3.10 GTK+ also supports baseline vertical alignment of widgets. This means that widgets are positioned such that the typographical baseline of widgets in the same row are aligned. This happens if a widget supports baselines, has a vertical alignment of - Gtk.Align.BASELINE, and is inside a container that supports baselines and has a natural “row” that it aligns to the baseline, or a baseline assigned to it by the grandparent.- Baseline alignment support for a widget is done by the - Gtk.Widget.do_get_preferred_height_and_baseline_for_width() virtual function. It allows you to report a baseline in combination with the minimum and natural height. If there is no baseline you can return -1 to indicate this. The default implementation of this virtual function calls into the- Gtk.Widget.do_get_preferred_height() and- Gtk.Widget.do_get_preferred_height_for_width(), so if baselines are not supported it doesn’t need to be implemented.- If a widget ends up baseline aligned it will be allocated all the space in the parent as if it was - Gtk.Align.FILL, but the selected baseline can be found via- Gtk.Widget.get_allocated_baseline(). If this has a value other than -1 you need to align the widget such that the baseline appears at the position.- Style Properties
 - Gtk.Widgetintroduces “style properties” - these are basically object properties that are stored not on the object, but in the style object associated to the widget. Style properties are set in resource files. This mechanism is used for configuring such things as the location of the scrollbar arrows through the theme, giving theme authors more control over the look of applications without the need to write a theme engine in C.- Use - Gtk.WidgetClass.install_style_property() to install style properties for a widget class,- Gtk.WidgetClass.find_style_property() or- Gtk.WidgetClass.list_style_properties() to get information about existing style properties and- Gtk.Widget.style_get_property(), gtk_widget_style_get() or gtk_widget_style_get_valist() to obtain the value of a style property.- The - Gtk.Widgetimplementation of the- Gtk.Buildableinterface supports a custom <accelerator> element, which has attributes named ”key”, ”modifiers” and ”signal” and allows to specify accelerators.- An example of a UI definition fragment specifying an accelerator: - <object class="GtkButton"> <accelerator key="q" modifiers="GDK_CONTROL_MASK" signal="clicked"/> </object> - In addition to accelerators, - Gtk.Widgetalso support a custom <accessible> element, which supports actions and relations. Properties on the accessible implementation of an object can be set by accessing the internal child “accessible” of a- Gtk.Widget.- An example of a UI definition fragment specifying an accessible: - <object class="GtkLabel" id="label1"/> <property name="label">I am a Label for a Button</property> </object> <object class="GtkButton" id="button1"> <accessibility> <action action_name="click" translatable="yes">Click the button.</action> <relation target="label1" type="labelled-by"/> </accessibility> <child internal-child="accessible"> <object class="AtkObject" id="a11y-button1"> <property name="accessible-name">Clickable Button</property> </object> </child> </object>- Finally, - Gtk.Widgetallows style information such as style classes to be associated with widgets, using the custom <style> element:- <object class="GtkButton" id="button1"> <style> <class name="my-special-button-class"/> <class name="dark-button"/> </style> </object>- Building composite widgets from template XML
 - Gtk.Widgetexposes some facilities to automate the procedure of creating composite widgets using- Gtk.Builderinterface description language.- To create composite widgets with - Gtk.BuilderXML, one must associate the interface description with the widget class at class initialization time using- Gtk.WidgetClass.set_template().- The interface description semantics expected in composite template descriptions is slightly different from regular - Gtk.BuilderXML.- Unlike regular interface descriptions, - Gtk.WidgetClass.set_template() will expect a <template> tag as a direct child of the toplevel <interface> tag. The <template> tag must specify the “class” attribute which must be the type name of the widget. Optionally, the “parent” attribute may be specified to specify the direct parent type of the widget type, this is ignored by the- Gtk.Builderbut required for Glade to introspect what kind of properties and internal children exist for a given type when the actual type does not exist.- The XML which is contained inside the <template> tag behaves as if it were added to the <object> tag defining widget itself. You may set properties on widget by inserting <property> tags into the <template> tag, and also add <child> tags to add children and extend widget in the normal way you would with <object> tags. - Additionally, <object> tags can also be added before and after the initial <template> tag in the normal way, allowing one to define auxiliary objects which might be referenced by other widgets declared as children of the <template> tag. - An example of a - Gtk.BuilderTemplate Definition:- <interface> <template class="FooWidget" parent="GtkBox"> <property name="orientation">GTK_ORIENTATION_HORIZONTAL</property> <property name="spacing">4</property> <child> <object class="GtkButton" id="hello_button"> <property name="label">Hello World</property> <signal name="clicked" handler="hello_button_clicked" object="FooWidget" swapped="yes"/> </object> </child> <child> <object class="GtkButton" id="goodbye_button"> <property name="label">Goodbye World</property> </object> </child> </template> </interface>- Typically, you’ll place the template fragment into a file that is bundled with your project, using - Gio.Resource. In order to load the template, you need to call- Gtk.WidgetClass.set_template_from_resource() from the class initialization of your- Gtk.Widgettype:- static void foo_widget_class_init (FooWidgetClass *klass) { // ... gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/com/example/ui/foowidget.ui"); } - You will also need to call - Gtk.Widget.init_template() from the instance initialization function:- static void foo_widget_init (FooWidget *self) { // ... gtk_widget_init_template (GTK_WIDGET (self)); } - You can access widgets defined in the template using the - Gtk.Widget.get_template_child() function, but you will typically declare a pointer in the instance private data structure of your type using the same name as the widget in the template definition, and call gtk_widget_class_bind_template_child_private() with that name, e.g.- typedef struct { GtkWidget *hello_button; GtkWidget *goodbye_button; } FooWidgetPrivate; G_DEFINE_TYPE_WITH_PRIVATE (FooWidget, foo_widget, GTK_TYPE_BOX) static void foo_widget_class_init (FooWidgetClass *klass) { // ... gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/com/example/ui/foowidget.ui"); gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), FooWidget, hello_button); gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), FooWidget, goodbye_button); } static void foo_widget_init (FooWidget *widget) { } - You can also use gtk_widget_class_bind_template_callback() to connect a signal callback defined in the template with a function visible in the scope of the class, e.g. - // the signal handler has the instance and user data swapped // because of the swapped="yes" attribute in the template XML static void hello_button_clicked (FooWidget *self, GtkButton *button) { g_print ("Hello, world!\n"); } static void foo_widget_class_init (FooWidgetClass *klass) { // ... gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/com/example/ui/foowidget.ui"); gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (klass), hello_button_clicked); } - 
classmethod bind_template_callback_full(callback_name, callback_symbol)¶
- Parameters: - callback_name (str) – The name of the callback as expected in the template XML
- callback_symbol (GObject.Callback) – The callback symbol
 - Declares a callback_symbol to handle callback_name from the template XML defined for widget_type. See - Gtk.Builder.add_callback_symbol().- Note that this must be called from a composite widget classes class initializer after calling - Gtk.WidgetClass.set_template().- New in version 3.10. 
- callback_name (
 - 
classmethod bind_template_child_full(name, internal_child, struct_offset)¶
- Parameters: - name (str) – The “id” of the child defined in the template XML
- internal_child (bool) – Whether the child should be accessible as an “internal-child” when this class is used inGtk.BuilderXML
- struct_offset (int) – The structure offset into the composite widget’s instance public or private structure where the automated child pointer should be set, or 0 to not assign the pointer.
 - Automatically assign an object declared in the class template XML to be set to a location on a freshly built instance’s private data, or alternatively accessible via - Gtk.Widget.get_template_child().- The struct can point either into the public instance, then you should use G_STRUCT_OFFSET(WidgetType, member) for struct_offset, or in the private struct, then you should use G_PRIVATE_OFFSET(WidgetType, member). - An explicit strong reference will be held automatically for the duration of your instance’s life cycle, it will be released automatically when - GObject.Object.do_dispose() runs on your instance and if a struct_offset that is != 0 is specified, then the automatic location in your instance public or private data will be set to- None. You can however access an automated child pointer the first time your classes- GObject.Object.do_dispose() runs, or alternatively in- Gtk.Widget.do_destroy().- If internal_child is specified, - Gtk.Buildable.do_get_internal_child() will be automatically implemented by the- Gtk.Widgetclass so there is no need to implement it manually.- The wrapper macros gtk_widget_class_bind_template_child(), gtk_widget_class_bind_template_child_internal(), gtk_widget_class_bind_template_child_private() and gtk_widget_class_bind_template_child_internal_private() might be more convenient to use. - Note that this must be called from a composite widget classes class initializer after calling - Gtk.WidgetClass.set_template().- New in version 3.10. 
- name (
 - 
classmethod find_style_property(property_name)¶
- Parameters: - property_name ( - str) – the name of the style property to find- Returns: - the - GObject.ParamSpecof the style property or- Noneif class has no style property with that name.- Return type: - GObject.ParamSpec- Finds a style property of a widget class by name. - New in version 2.2. 
 - 
classmethod get_css_name()¶
- Returns: - the CSS name of the given class - Return type: - str- Gets the name used by this class for matching in CSS code. See - Gtk.WidgetClass.set_css_name() for details.- New in version 3.20. 
 - 
classmethod get_default_direction()[source]¶
- Returns: - the current default direction. - Return type: - Gtk.TextDirection- Obtains the current default reading direction. See - Gtk.Widget.set_default_direction().
 - 
classmethod get_default_style()[source]¶
- Returns: - the default style. This - Gtk.Styleobject is owned by GTK+ and should not be modified or freed.- Return type: - Gtk.Style- Returns the default style used by all widgets initially. - Deprecated since version 3.0: Use - Gtk.StyleContextinstead, and- Gtk.CssProvider.get_default() to obtain a- Gtk.StyleProviderwith the default widget style information.
 - 
classmethod install_style_property(pspec)¶
- Parameters: - pspec ( - GObject.ParamSpec) – the- GObject.ParamSpecfor the property- Installs a style property on a widget class. The parser for the style property is determined by the value type of pspec. 
 - 
classmethod list_style_properties()¶
- Returns: - a newly allocated array of - GObject.ParamSpec. The array must be freed with- GLib.free().- Return type: - [ - GObject.ParamSpec]- Returns all style properties of a widget class. - New in version 2.2. 
 - 
classmethod pop_composite_child()[source]¶
- Cancels the effect of a previous call to - Gtk.Widget.push_composite_child().- Deprecated since version 3.10: Use - Gtk.WidgetClass.set_template(), or don’t use this API at all.
 - 
classmethod push_composite_child()[source]¶
- Makes all newly-created widgets as composite children until the corresponding - Gtk.Widget.pop_composite_child() call.- A composite child is a child that’s an implementation detail of the container it’s inside and should not be visible to people using the container. Composite children aren’t treated differently by GTK+ (but see - Gtk.Container.foreach() vs.- Gtk.Container.forall()), but e.g. GUI builders might want to treat them in a different way.- Deprecated since version 3.10: This API never really worked well and was mostly unused, now we have a more complete mechanism for composite children, see - Gtk.WidgetClass.set_template().
 - 
classmethod set_accessible_role(role)¶
- Parameters: - role ( - Atk.Role) – The role to use for accessibles created for self- Sets the default - Atk.Roleto be set on accessibles created for widgets of self. Accessibles may decide to not honor this setting if their role reporting is more refined. Calls to- Gtk.WidgetClass.set_accessible_type() will reset this value.- In cases where you want more fine-grained control over the role of accessibles created for self, you should provide your own accessible type and use - Gtk.WidgetClass.set_accessible_type() instead.- If role is - Atk.Role.INVALID, the default role will not be changed and the accessible’s default role will be used instead.- This function should only be called from class init functions of widgets. - New in version 3.2. 
 - 
classmethod set_accessible_type(type)¶
- Parameters: - type ( - GObject.GType) – The object type that implements the accessible for self- Sets the type to be used for creating accessibles for widgets of self. The given type must be a subtype of the type used for accessibles of the parent class. - This function should only be called from class init functions of widgets. - New in version 3.2. 
 - 
classmethod set_connect_func(connect_func, *connect_data)¶
- Parameters: - connect_func (Gtk.BuilderConnectFunc) – TheGtk.BuilderConnectFuncto use when connecting signals in the class template
- connect_data (objectorNone) – The data to pass to connect_func
 - For use in language bindings, this will override the default - Gtk.BuilderConnectFuncto be used when parsing- Gtk.BuilderXML from this class’s template data.- Note that this must be called from a composite widget classes class initializer after calling - Gtk.WidgetClass.set_template().- New in version 3.10. 
- connect_func (
 - 
classmethod set_css_name(name)¶
- Parameters: - name ( - str) – name to use- Sets the name to be used for CSS matching of widgets. - If this function is not called for a given class, the name of the parent class is used. - New in version 3.20. 
 - 
classmethod set_default_direction(dir)[source]¶
- Parameters: - dir ( - Gtk.TextDirection) – the new default direction. This cannot be- Gtk.TextDirection.NONE.- Sets the default reading direction for widgets where the direction has not been explicitly set by - Gtk.Widget.set_direction().
 - 
classmethod set_template(template_bytes)¶
- Parameters: - template_bytes ( - GLib.Bytes) – A- GLib.Bytesholding the- Gtk.BuilderXML- This should be called at class initialization time to specify the - Gtk.BuilderXML to be used to extend a widget.- For convenience, - Gtk.WidgetClass.set_template_from_resource() is also provided.- Note that any class that installs templates must call - Gtk.Widget.init_template() in the widget’s instance initializer.- New in version 3.10. 
 - 
classmethod set_template_from_resource(resource_name)¶
- Parameters: - resource_name ( - str) – The name of the resource to load the template from- A convenience function to call - Gtk.WidgetClass.set_template().- Note that any class that installs templates must call - Gtk.Widget.init_template() in the widget’s instance initializer.- New in version 3.10. 
 - 
activate()[source]¶
- Returns: - Trueif the widget was activatable- Return type: - bool- For widgets that can be “activated” (buttons, menu items, etc.) this function activates them. Activation is what happens when you press Enter on a widget during key navigation. If self isn’t activatable, the function returns - False.
 - 
add_accelerator(accel_signal, accel_group, accel_key, accel_mods, accel_flags)[source]¶
- Parameters: - accel_signal (str) – widget signal to emit on accelerator activation
- accel_group (Gtk.AccelGroup) – accel group for this widget, added to its toplevel
- accel_key (int) – GDK keyval of the accelerator
- accel_mods (Gdk.ModifierType) – modifier key combination of the accelerator
- accel_flags (Gtk.AccelFlags) – flag accelerators, e.g.Gtk.AccelFlags.VISIBLE
 - Installs an accelerator for this self in accel_group that causes accel_signal to be emitted if the accelerator is activated. The accel_group needs to be added to the widget’s toplevel via - Gtk.Window.add_accel_group(), and the signal must be of type- GObject.SignalFlags.ACTION. Accelerators added through this function are not user changeable during runtime. If you want to support accelerators that can be changed by the user, use- Gtk.AccelMap.add_entry() and- Gtk.Widget.set_accel_path() or- Gtk.MenuItem.set_accel_path() instead.
- accel_signal (
 - 
add_device_events(device, events)[source]¶
- Parameters: - device (Gdk.Device) – aGdk.Device
- events (Gdk.EventMask) – an event mask, seeGdk.EventMask
 - Adds the device events in the bitfield events to the event mask for self. See - Gtk.Widget.set_device_events() for details.- New in version 3.0. 
- device (
 - 
add_events(events)[source]¶
- Parameters: - events ( - int) – an event mask, see- Gdk.EventMask- Adds the events in the bitfield events to the event mask for self. See - Gtk.Widget.set_events() and the input handling overview for details.
 - 
add_mnemonic_label(label)[source]¶
- Parameters: - label ( - Gtk.Widget) – a- Gtk.Widgetthat acts as a mnemonic label for self- Adds a widget to the list of mnemonic labels for this widget. (See - Gtk.Widget.list_mnemonic_labels()). Note the list of mnemonic labels for the widget is cleared when the widget is destroyed, so the caller must make sure to update its internal state at this point as well, by using a connection to the- Gtk.Widget- ::destroysignal or a weak notifier.- New in version 2.4. 
 - 
add_tick_callback(callback, *user_data)[source]¶
- Parameters: - callback (Gtk.TickCallback) – function to call for updating animations
- user_data (objectorNone) – data to pass to callback
 - Returns: - an id for the connection of this callback. Remove the callback by passing it to - Gtk.Widget.remove_tick_callback()- Return type: - Queues an animation frame update and adds a callback to be called before each frame. Until the tick callback is removed, it will be called frequently (usually at the frame rate of the output device or as quickly as the application can be repainted, whichever is slower). For this reason, is most suitable for handling graphics that change every frame or every few frames. The tick callback does not automatically imply a relayout or repaint. If you want a repaint or relayout, and aren’t changing widget properties that would trigger that (for example, changing the text of a - Gtk.Label), then you will have to call- Gtk.Widget.queue_resize() or- Gtk.Widget.queue_draw_area() yourself.- Gdk.FrameClock.get_frame_time() should generally be used for timing continuous animations and- Gdk.FrameTimings.get_predicted_presentation_time() if you are trying to display isolated frames at particular times.- This is a more convenient alternative to connecting directly to the - Gdk.FrameClock- ::updatesignal of- Gdk.FrameClock, since you don’t have to worry about when a- Gdk.FrameClockis assigned to a widget.- New in version 3.8. 
- callback (
 - 
can_activate_accel(signal_id)[source]¶
- Parameters: - signal_id ( - int) – the ID of a signal installed on self- Returns: - Trueif the accelerator can be activated.- Return type: - bool- Determines whether an accelerator that activates the signal identified by signal_id can currently be activated. This is done by emitting the - Gtk.Widget- ::can-activate-accelsignal on self; if the signal isn’t overridden by a handler or in a derived widget, then the default check is that the widget must be sensitive, and the widget and all its ancestors mapped.- New in version 2.4. 
 - 
child_focus(direction)[source]¶
- Parameters: - direction ( - Gtk.DirectionType) – direction of focus movement- Returns: - Trueif focus ended up inside self- Return type: - bool- This function is used by custom widget implementations; if you’re writing an app, you’d use - Gtk.Widget.grab_focus() to move the focus to a particular widget, and- Gtk.Container.set_focus_chain() to change the focus tab order. So you may want to investigate those functions instead.- Gtk.Widget.child_focus() is called by containers as the user moves around the window using keyboard shortcuts. direction indicates what kind of motion is taking place (up, down, left, right, tab forward, tab backward).- Gtk.Widget.child_focus() emits the- Gtk.Widget- ::focussignal; widgets override the default handler for this signal in order to implement appropriate focus behavior.- The default - ::focushandler for a widget should return- Trueif moving in direction left the focus on a focusable location inside that widget, and- Falseif moving in direction moved the focus outside the widget. If returning- True, widgets normally call- Gtk.Widget.grab_focus() to place the focus accordingly; if returning- False, they don’t modify the current focus location.
 - 
child_notify(child_property)[source]¶
- Parameters: - child_property ( - str) – the name of a child property installed on the class of self’s parent- Emits a - Gtk.Widget- ::child-notifysignal for the ‘child property [child-properties]’ child_property on self.- This is the analogue of - GObject.Object.notify() for child properties.- Also see - Gtk.Container.child_notify().
 - 
class_path()[source]¶
- Returns: - path_length: - location to store the length of the class path, or - None- path: - location to store the class path as an allocated string, or - None- path_reversed: - location to store the reverse class path as an allocated string, or - None- Return type: - (path_length: - int, path:- str, path_reversed:- str)- Same as - Gtk.Widget.path(), but always uses the name of a widget’s type, never uses a custom name set with- Gtk.Widget.set_name().- Deprecated since version 3.0: Use - Gtk.Widget.get_path() instead
 - 
compute_expand(orientation)[source]¶
- Parameters: - orientation ( - Gtk.Orientation) – expand direction- Returns: - whether widget tree rooted here should be expanded - Return type: - bool- Computes whether a container should give this widget extra space when possible. Containers should check this, rather than looking at - Gtk.Widget.get_hexpand() or- Gtk.Widget.get_vexpand().- This function already checks whether the widget is visible, so visibility does not need to be checked separately. Non-visible widgets are not expanded. - The computed expand value uses either the expand setting explicitly set on the widget itself, or, if none has been explicitly set, the widget may expand if some of its children do. 
 - 
create_pango_context()[source]¶
- Returns: - the new - Pango.Context- Return type: - Pango.Context- Creates a new - Pango.Contextwith the appropriate font map, font options, font description, and base direction for drawing text for this widget. See also- Gtk.Widget.get_pango_context().
 - 
create_pango_layout(text)[source]¶
- Parameters: - text ( - stror- None) – text to set on the layout (can be- None)- Returns: - the new - Pango.Layout- Return type: - Pango.Layout- Creates a new - Pango.Layoutwith the appropriate font map, font description, and base direction for drawing text for this widget.- If you keep a - Pango.Layoutcreated in this way around, you need to re-create it when the widget- Pango.Contextis replaced. This can be tracked by using the- Gtk.Widget- ::screen-changedsignal on the widget.
 - 
destroy()[source]¶
- Destroys a widget. - When a widget is destroyed all references it holds on other objects will be released: - if the widget is inside a container, it will be removed from its parent
- if the widget is a container, all its children will be destroyed, recursively
- if the widget is a top level, it will be removed from the list of top level widgets that GTK+ maintains internally
 - It’s expected that all references held on the widget will also be released; you should connect to the - Gtk.Widget- ::destroysignal if you hold a reference to self and you wish to remove it when this function is called. It is not necessary to do so if you are implementing a- Gtk.Container, as you’ll be able to use the- Gtk.Container.do_remove() virtual function for that.- It’s important to notice that - Gtk.Widget.destroy() will only cause the self to be finalized if no additional references, acquired using- GObject.Object.ref(), are held on it. In case additional references are in place, the self will be in an “inert” state after calling this function; self will still point to valid memory, allowing you to release the references you hold, but you may not query the widget’s own state.- You should typically call this function on top level widgets, and rarely on child widgets. - See also: - Gtk.Container.remove()
 - 
destroyed(widget_pointer)[source]¶
- Parameters: - widget_pointer ( - Gtk.Widget) – address of a variable that contains self- Returns: - address of a variable that contains self - Return type: - widget_pointer: - Gtk.Widget- This function sets widget_pointer to - Noneif widget_pointer !=- None. It’s intended to be used as a callback connected to the “destroy” signal of a widget. You connect- Gtk.Widget.destroyed() as a signal handler, and pass the address of your widget variable as user data. Then when the widget is destroyed, the variable will be set to- None. Useful for example to avoid multiple copies of the same dialog.
 - 
device_is_shadowed(device)[source]¶
- Parameters: - device ( - Gdk.Device) – a- Gdk.Device- Returns: - Trueif there is an ongoing grab on device by another- Gtk.Widgetthan self.- Return type: - bool- Returns - Trueif device has been shadowed by a GTK+ device grab on another widget, so it would stop sending events to self. This may be used in the- Gtk.Widget- ::grab-notifysignal to check for specific devices. See- Gtk.device_grab_add().- New in version 3.0. 
 - 
drag_begin(targets, actions, button, event)[source]¶
- Parameters: - targets (Gtk.TargetList) – The targets (data formats) in which the source can provide the data
- actions (Gdk.DragAction) – A bitmask of the allowed drag actions for this drag
- button (int) – The button the user clicked to start the drag
- event (Gdk.EventorNone) – The event that triggered the start of the drag, orNoneif none can be obtained.
 - Returns: - the context for this drag - Return type: - This function is equivalent to - Gtk.Widget.drag_begin_with_coordinates(), passing -1, -1 as coordinates.- Deprecated since version 3.10: Use - Gtk.Widget.drag_begin_with_coordinates() instead
- targets (
 - 
drag_begin_with_coordinates(targets, actions, button, event, x, y)[source]¶
- Parameters: - targets (Gtk.TargetList) – The targets (data formats) in which the source can provide the data
- actions (Gdk.DragAction) – A bitmask of the allowed drag actions for this drag
- button (int) – The button the user clicked to start the drag
- event (Gdk.EventorNone) – The event that triggered the start of the drag, orNoneif none can be obtained.
- x (int) – The initial x coordinate to start dragging from, in the coordinate space of self. If -1 is passed, the coordinates are retrieved from event or the current pointer position
- y (int) – The initial y coordinate to start dragging from, in the coordinate space of self. If -1 is passed, the coordinates are retrieved from event or the current pointer position
 - Returns: - the context for this drag - Return type: - Initiates a drag on the source side. The function only needs to be used when the application is starting drags itself, and is not needed when - Gtk.Widget.drag_source_set() is used.- The event is used to retrieve the timestamp that will be used internally to grab the pointer. If event is - None, then- Gdk.CURRENT_TIMEwill be used. However, you should try to pass a real event in all cases, since that can be used to get information about the drag.- Generally there are three cases when you want to start a drag by hand by calling this function: - During a - Gtk.Widget- ::button-press-eventhandler, if you want to start a drag immediately when the user presses the mouse button. Pass the event that you have in your- Gtk.Widget- ::button-press-eventhandler.- During a - Gtk.Widget- ::motion-notify-eventhandler, if you want to start a drag when the mouse moves past a certain threshold distance after a button-press. Pass the event that you have in your- Gtk.Widget- ::motion-notify-eventhandler.- During a timeout handler, if you want to start a drag after the mouse button is held down for some time. Try to save the last event that you got from the mouse, using - Gdk.Event.copy(), and pass it to this function (remember to free the event with- Gdk.Event.free() when you are done). If you really cannot pass a real event, pass- Noneinstead.- New in version 3.10. 
- targets (
 - 
drag_check_threshold(start_x, start_y, current_x, current_y)[source]¶
- Parameters: - Returns: - Trueif the drag threshold has been passed.- Return type: - Checks to see if a mouse drag starting at (start_x, start_y) and ending at (current_x, current_y) has passed the GTK+ drag threshold, and thus should trigger the beginning of a drag-and-drop operation. 
 - 
drag_dest_add_image_targets()[source]¶
- Add the image targets supported by - Gtk.SelectionDatato the target list of the drag destination. The targets are added with info = 0. If you need another value, use- Gtk.TargetList.add_image_targets() and- Gtk.Widget.drag_dest_set_target_list().- New in version 2.6. 
 - 
drag_dest_add_text_targets()[source]¶
- Add the text targets supported by - Gtk.SelectionDatato the target list of the drag destination. The targets are added with info = 0. If you need another value, use- Gtk.TargetList.add_text_targets() and- Gtk.Widget.drag_dest_set_target_list().- New in version 2.6. 
 - 
drag_dest_add_uri_targets()[source]¶
- Add the URI targets supported by - Gtk.SelectionDatato the target list of the drag destination. The targets are added with info = 0. If you need another value, use- Gtk.TargetList.add_uri_targets() and- Gtk.Widget.drag_dest_set_target_list().- New in version 2.6. 
 - 
drag_dest_find_target(context, target_list)[source]¶
- Parameters: - context (Gdk.DragContext) – drag context
- target_list (Gtk.TargetListorNone) – list of droppable targets, orNoneto useGtk.Widget.drag_dest_get_target_list(self).
 - Returns: - first target that the source offers and the dest can accept, or %GDK_NONE - Return type: - Looks for a match between the supported targets of context and the dest_target_list, returning the first matching target, otherwise returning %GDK_NONE. dest_target_list should usually be the return value from - Gtk.Widget.drag_dest_get_target_list(), but some widgets may have different valid targets for different parts of the widget; in that case, they will have to implement a drag_motion handler that passes the correct target list to this function.
- context (
 - 
drag_dest_get_target_list()[source]¶
- Returns: - the - Gtk.TargetList, or- Noneif none- Return type: - Gtk.TargetListor- None- Returns the list of targets this widget can accept from drag-and-drop. 
 - 
drag_dest_get_track_motion()[source]¶
- Returns: - Trueif the widget always emits- Gtk.Widget- ::drag-motionevents- Return type: - bool- Returns whether the widget has been configured to always emit - Gtk.Widget- ::drag-motionsignals.- New in version 2.10. 
 - 
drag_dest_set(flags, targets, actions)[source]¶
- Parameters: - flags (Gtk.DestDefaults) – which types of default drag behavior to use
- targets ([Gtk.TargetEntry] orNone) – a pointer to an array ofGtk.TargetEntrysindicating the drop types that this self will accept, orNone. Later you can access the list withGtk.Widget.drag_dest_get_target_list() andGtk.Widget.drag_dest_find_target().
- actions (Gdk.DragAction) – a bitmask of possible actions for a drop onto this self.
 - Sets a widget as a potential drop destination, and adds default behaviors. - The default behaviors listed in flags have an effect similar to installing default handlers for the widget’s drag-and-drop signals ( - Gtk.Widget- ::drag-motion,- Gtk.Widget- ::drag-drop, …). They all exist for convenience. When passing- Gtk.DestDefaults.ALLfor instance it is sufficient to connect to the widget’s- Gtk.Widget- ::drag-data-receivedsignal to get primitive, but consistent drag-and-drop support.- Things become more complicated when you try to preview the dragged data, as described in the documentation for - Gtk.Widget- ::drag-motion. The default behaviors described by flags make some assumptions, that can conflict with your own signal handlers. For instance- Gtk.DestDefaults.DROPcauses invokations of- Gdk.drag_status() in the context of- Gtk.Widget- ::drag-motion, and invokations of- Gtk.drag_finish() in- Gtk.Widget- ::drag-data-received. Especially the later is dramatic, when your own- Gtk.Widget- ::drag-motionhandler calls- Gtk.Widget.drag_get_data() to inspect the dragged data.- There’s no way to set a default action here, you can use the - Gtk.Widget- ::drag-motioncallback for that. Here’s an example which selects the action to use depending on whether the control key is pressed or not:- static void drag_motion (GtkWidget *widget, GdkDragContext *context, gint x, gint y, guint time) { GdkModifierType mask; gdk_window_get_pointer (gtk_widget_get_window (widget), NULL, NULL, &mask); if (mask & GDK_CONTROL_MASK) gdk_drag_status (context, GDK_ACTION_COPY, time); else gdk_drag_status (context, GDK_ACTION_MOVE, time); } 
- flags (
 - 
drag_dest_set_proxy(proxy_window, protocol, use_coordinates)[source]¶
- Parameters: - proxy_window (Gdk.Window) – the window to which to forward drag events
- protocol (Gdk.DragProtocol) – the drag protocol which the proxy_window accepts (You can use gdk_drag_get_protocol() to determine this)
- use_coordinates (bool) – IfTrue, send the same coordinates to the destination, because it is an embedded subwindow.
 - Sets this widget as a proxy for drops to another window. - Deprecated since version 3.22. 
- proxy_window (
 - 
drag_dest_set_target_list(target_list)[source]¶
- Parameters: - target_list ( - Gtk.TargetListor- None) – list of droppable targets, or- Nonefor none- Sets the target types that this widget can accept from drag-and-drop. The widget must first be made into a drag destination with - Gtk.Widget.drag_dest_set().
 - 
drag_dest_set_track_motion(track_motion)[source]¶
- Parameters: - track_motion ( - bool) – whether to accept all targets- Tells the widget to emit - Gtk.Widget- ::drag-motionand- Gtk.Widget- ::drag-leaveevents regardless of the targets and the- Gtk.DestDefaults.MOTIONflag.- This may be used when a widget wants to do generic actions regardless of the targets that the source offers. - New in version 2.10. 
 - 
drag_dest_unset()[source]¶
- Clears information about a drop destination set with - Gtk.Widget.drag_dest_set(). The widget will no longer receive notification of drags.
 - 
drag_get_data(context, target, time_)[source]¶
- Parameters: - context (Gdk.DragContext) – the drag context
- target (Gdk.Atom) – the target (form of the data) to retrieve
- time (int) – a timestamp for retrieving the data. This will generally be the time received in aGtk.Widget::drag-motionorGtk.Widget::drag-dropsignal
 - Gets the data associated with a drag. When the data is received or the retrieval fails, GTK+ will emit a - Gtk.Widget- ::drag-data-receivedsignal. Failure of the retrieval is indicated by the length field of the selection_data signal parameter being negative. However, when- Gtk.Widget.drag_get_data() is called implicitely because the- Gtk.DestDefaults.DROPwas set, then the widget will not receive notification of failed drops.
- context (
 - 
drag_highlight()[source]¶
- Highlights a widget as a currently hovered drop target. To end the highlight, call - Gtk.Widget.drag_unhighlight(). GTK+ calls this automatically if- Gtk.DestDefaults.HIGHLIGHTis set.
 - 
drag_source_add_image_targets()[source]¶
- Add the writable image targets supported by - Gtk.SelectionDatato the target list of the drag source. The targets are added with info = 0. If you need another value, use- Gtk.TargetList.add_image_targets() and- Gtk.Widget.drag_source_set_target_list().- New in version 2.6. 
 - 
drag_source_add_text_targets()[source]¶
- Add the text targets supported by - Gtk.SelectionDatato the target list of the drag source. The targets are added with info = 0. If you need another value, use- Gtk.TargetList.add_text_targets() and- Gtk.Widget.drag_source_set_target_list().- New in version 2.6. 
 - 
drag_source_add_uri_targets()[source]¶
- Add the URI targets supported by - Gtk.SelectionDatato the target list of the drag source. The targets are added with info = 0. If you need another value, use- Gtk.TargetList.add_uri_targets() and- Gtk.Widget.drag_source_set_target_list().- New in version 2.6. 
 - 
drag_source_get_target_list()[source]¶
- Returns: - the - Gtk.TargetList, or- Noneif none- Return type: - Gtk.TargetListor- None- Gets the list of targets this widget can provide for drag-and-drop. - New in version 2.4. 
 - 
drag_source_set(start_button_mask, targets, actions)[source]¶
- Parameters: - start_button_mask (Gdk.ModifierType) – the bitmask of buttons that can start the drag
- targets ([Gtk.TargetEntry] orNone) – the table of targets that the drag will support, may beNone
- actions (Gdk.DragAction) – the bitmask of possible actions for a drag from this widget
 - Sets up a widget so that GTK+ will start a drag operation when the user clicks and drags on the widget. The widget must have a window. 
- start_button_mask (
 - 
drag_source_set_icon_gicon(icon)[source]¶
- Parameters: - icon ( - Gio.Icon) – A- Gio.Icon- Sets the icon that will be used for drags from a particular source to icon. See the docs for - Gtk.IconThemefor more details.- New in version 3.2. 
 - 
drag_source_set_icon_name(icon_name)[source]¶
- Parameters: - icon_name ( - str) – name of icon to use- Sets the icon that will be used for drags from a particular source to a themed icon. See the docs for - Gtk.IconThemefor more details.- New in version 2.8. 
 - 
drag_source_set_icon_pixbuf(pixbuf)[source]¶
- Parameters: - pixbuf ( - GdkPixbuf.Pixbuf) – the- GdkPixbuf.Pixbuffor the drag icon- Sets the icon that will be used for drags from a particular widget from a - GdkPixbuf.Pixbuf. GTK+ retains a reference for pixbuf and will release it when it is no longer needed.
 - 
drag_source_set_icon_stock(stock_id)[source]¶
- Parameters: - stock_id ( - str) – the ID of the stock icon to use- Sets the icon that will be used for drags from a particular source to a stock icon. - Deprecated since version 3.10: Use - Gtk.Widget.drag_source_set_icon_name() instead.
 - 
drag_source_set_target_list(target_list)[source]¶
- Parameters: - target_list ( - Gtk.TargetListor- None) – list of draggable targets, or- Nonefor none- Changes the target types that this widget offers for drag-and-drop. The widget must first be made into a drag source with - Gtk.Widget.drag_source_set().- New in version 2.4. 
 - 
drag_source_unset()[source]¶
- Undoes the effects of - Gtk.Widget.drag_source_set().
 - 
drag_unhighlight()[source]¶
- Removes a highlight set by - Gtk.Widget.drag_highlight() from a widget.
 - 
draw(cr)[source]¶
- Parameters: - cr ( - cairo.Context) – a cairo context to draw to- Draws self to cr. The top left corner of the widget will be drawn to the currently set origin point of cr. - You should pass a cairo context as cr argument that is in an original state. Otherwise the resulting drawing is undefined. For example changing the operator using - cairo.Context.set_operator() or the line width using- cairo.Context.set_line_width() might have unwanted side effects. You may however change the context’s transform matrix - like with- cairo.Context.scale(),- cairo.Context.translate() or- cairo.Context.set_matrix() and clip region with- cairo.Context.clip() prior to calling this function. Also, it is fine to modify the context with- cairo.Context.save() and- cairo.Context.push_group() prior to calling this function.- Note that special-purpose widgets may contain special code for rendering to the screen and might appear differently on screen and when rendered using - Gtk.Widget.draw().- New in version 3.0. 
 - 
ensure_style()[source]¶
- Ensures that self has a style (self->style). - Not a very useful function; most of the time, if you want the style, the widget is realized, and realized widgets are guaranteed to have a style already. - Deprecated since version 3.0: Use - Gtk.StyleContextinstead
 - 
error_bell()[source]¶
- Notifies the user about an input-related error on this widget. If the - Gtk.Settings- :gtk-error-bellsetting is- True, it calls- Gdk.Window.beep(), otherwise it does nothing.- Note that the effect of - Gdk.Window.beep() can be configured in many ways, depending on the windowing backend and the desktop environment or window manager that is used.- New in version 2.12. 
 - 
event(event)[source]¶
- Parameters: - event ( - Gdk.Event) – a- Gdk.Event- Returns: - return from the event signal emission ( - Trueif the event was handled)- Return type: - bool- Rarely-used function. This function is used to emit the event signals on a widget (those signals should never be emitted without using this function to do so). If you want to synthesize an event though, don’t use this function; instead, use - Gtk.main_do_event() so the event will behave as if it were in the event queue. Don’t synthesize expose events; instead, use- Gdk.Window.invalidate_rect() to invalidate a region of the window.
 - 
freeze_child_notify()[source]¶
- Stops emission of - Gtk.Widget- ::child-notifysignals on self. The signals are queued until- Gtk.Widget.thaw_child_notify() is called on self.- This is the analogue of - GObject.Object.freeze_notify() for child properties.
 - 
get_accessible()[source]¶
- Returns: - the - Atk.Objectassociated with self- Return type: - Atk.Object- Returns the accessible object that describes the widget to an assistive technology. - If accessibility support is not available, this - Atk.Objectinstance may be a no-op. Likewise, if no class-specific- Atk.Objectimplementation is available for the widget instance in question, it will inherit an- Atk.Objectimplementation from the first ancestor class for which such an implementation is defined.- The documentation of the ATK library contains more information about accessible objects and their uses. 
 - 
get_action_group(prefix)[source]¶
- Parameters: - prefix ( - str) – The “prefix” of the action group.- Returns: - A - Gio.ActionGroupor- None.- Return type: - Gio.ActionGroupor- None- Retrieves the - Gio.ActionGroupthat was registered using prefix. The resulting- Gio.ActionGroupmay have been registered to self or any- Gtk.Widgetin its ancestry.- If no action group was found matching prefix, then - Noneis returned.- New in version 3.16. 
 - 
get_allocated_baseline()[source]¶
- Returns: - the baseline of the self, or -1 if none - Return type: - int- Returns the baseline that has currently been allocated to self. This function is intended to be used when implementing handlers for the - Gtk.Widget- ::drawfunction, and when allocating child widgets in #GtkWidget::size_allocate.- New in version 3.10. 
 - 
get_allocated_height()[source]¶
- Returns: - the height of the self - Return type: - int- Returns the height that has currently been allocated to self. This function is intended to be used when implementing handlers for the - Gtk.Widget- ::drawfunction.
 - 
get_allocated_size()[source]¶
- Returns: - allocation: - a pointer to a #GtkAllocation to copy to - baseline: - a pointer to an integer to copy to - Return type: - (allocation: - Gdk.Rectangle, baseline:- int)- Retrieves the widget’s allocated size. - This function returns the last values passed to - Gtk.Widget.size_allocate_with_baseline(). The value differs from the size returned in- Gtk.Widget.get_allocation() in that functions like- Gtk.Widget.set_halign() can adjust the allocation, but not the value returned by this function.- If a widget is not visible, its allocated size is 0. - New in version 3.20. 
 - 
get_allocated_width()[source]¶
- Returns: - the width of the self - Return type: - int- Returns the width that has currently been allocated to self. This function is intended to be used when implementing handlers for the - Gtk.Widget- ::drawfunction.
 - 
get_allocation()[source]¶
- Returns: - a pointer to a #GtkAllocation to copy to - Return type: - allocation: - Gdk.Rectangle- Retrieves the widget’s allocation. - Note, when implementing a - Gtk.Container: a widget’s allocation will be its “adjusted” allocation, that is, the widget’s parent container typically calls- Gtk.Widget.size_allocate() with an allocation, and that allocation is then adjusted (to handle margin and alignment for example) before assignment to the widget.- Gtk.Widget.get_allocation() returns the adjusted allocation that was actually assigned to the widget. The adjusted allocation is guaranteed to be completely contained within the- Gtk.Widget.size_allocate() allocation, however. So a- Gtk.Containeris guaranteed that its children stay inside the assigned bounds, but not that they have exactly the bounds the container assigned. There is no way to get the original allocation assigned by- Gtk.Widget.size_allocate(), since it isn’t stored; if a container implementation needs that information it will have to track it itself.- New in version 2.18. 
 - 
get_ancestor(widget_type)[source]¶
- Parameters: - widget_type ( - GObject.GType) – ancestor type- Returns: - the ancestor widget, or - Noneif not found- Return type: - Gtk.Widgetor- None- Gets the first ancestor of self with type widget_type. For example, - gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)gets the first- Gtk.Boxthat’s an ancestor of self. No reference will be added to the returned widget; it should not be unreferenced. See note about checking for a toplevel- Gtk.Windowin the docs for- Gtk.Widget.get_toplevel().- Note that unlike - Gtk.Widget.is_ancestor(),- Gtk.Widget.get_ancestor() considers self to be an ancestor of itself.
 - 
get_app_paintable()[source]¶
- Returns: - Trueif the widget is app paintable- Return type: - bool- Determines whether the application intends to draw on the widget in an - Gtk.Widget- ::drawhandler.- See - Gtk.Widget.set_app_paintable()- New in version 2.18. 
 - 
get_can_default()[source]¶
- Returns: - Trueif self can be a default widget,- Falseotherwise- Return type: - bool- Determines whether self can be a default widget. See - Gtk.Widget.set_can_default().- New in version 2.18. 
 - 
get_can_focus()[source]¶
- Returns: - Trueif self can own the input focus,- Falseotherwise- Return type: - bool- Determines whether self can own the input focus. See - Gtk.Widget.set_can_focus().- New in version 2.18. 
 - 
get_child_requisition()[source]¶
- Returns: - a - Gtk.Requisitionto be filled in- Return type: - requisition: - Gtk.Requisition- This function is only for use in widget implementations. Obtains self->requisition, unless someone has forced a particular geometry on the widget (e.g. with - Gtk.Widget.set_size_request()), in which case it returns that geometry instead of the widget’s requisition.- This function differs from - Gtk.Widget.size_request() in that it retrieves the last size request value from self->requisition, while- Gtk.Widget.size_request() actually calls the “size_request” method on self to compute the size request and fill in self->requisition, and only then returns self->requisition.- Because this function does not call the “size_request” method, it can only be used when you know that self->requisition is up-to-date, that is, - Gtk.Widget.size_request() has been called since the last time a resize was queued. In general, only container implementations have this information; applications should use- Gtk.Widget.size_request().- Deprecated since version 3.0: Use - Gtk.Widget.get_preferred_size() instead.
 - 
get_child_visible()[source]¶
- Returns: - Trueif the widget is mapped with the parent.- Return type: - bool- Gets the value set with - Gtk.Widget.set_child_visible(). If you feel a need to use this function, your code probably needs reorganization.- This function is only useful for container implementations and never should be called by an application. 
 - 
get_clip()[source]¶
- Returns: - a pointer to a #GtkAllocation to copy to - Return type: - clip: - Gdk.Rectangle- Retrieves the widget’s clip area. - The clip area is the area in which all of self’s drawing will happen. Other toolkits call it the bounding box. - Historically, in GTK+ the clip area has been equal to the allocation retrieved via - Gtk.Widget.get_allocation().- New in version 3.14. 
 - 
get_clipboard(selection)[source]¶
- Parameters: - selection ( - Gdk.Atom) – a- Gdk.Atomwhich identifies the clipboard to use. %GDK_SELECTION_CLIPBOARD gives the default clipboard. Another common value is %GDK_SELECTION_PRIMARY, which gives the primary X selection.- Returns: - the appropriate clipboard object. If no clipboard already exists, a new one will be created. Once a clipboard object has been created, it is persistent for all time. - Return type: - Gtk.Clipboard- Returns the clipboard object for the given selection to be used with self. self must have a - Gdk.Displayassociated with it, so must be attached to a toplevel window.- New in version 2.2. 
 - 
get_composite_name()[source]¶
- Returns: - the composite name of self, or - Noneif self is not a composite child. The string should be freed when it is no longer needed.- Return type: - str- Obtains the composite name of a widget. - Deprecated since version 3.10: Use - Gtk.WidgetClass.set_template(), or don’t use this API at all.
 - 
get_device_enabled(device)[source]¶
- Parameters: - device ( - Gdk.Device) – a- Gdk.Device- Returns: - Trueis device is enabled for self- Return type: - bool- Returns whether device can interact with self and its children. See - Gtk.Widget.set_device_enabled().- New in version 3.0. 
 - 
get_device_events(device)[source]¶
- Parameters: - device ( - Gdk.Device) – a- Gdk.Device- Returns: - device event mask for self - Return type: - Gdk.EventMask- Returns the events mask for the widget corresponding to an specific device. These are the events that the widget will receive when device operates on it. - New in version 3.0. 
 - 
get_direction()[source]¶
- Returns: - the reading direction for the widget. - Return type: - Gtk.TextDirection- Gets the reading direction for a particular widget. See - Gtk.Widget.set_direction().
 - 
get_display()[source]¶
- Returns: - the - Gdk.Displayfor the toplevel for this widget.- Return type: - Gdk.Display- Get the - Gdk.Displayfor the toplevel window associated with this widget. This function can only be called after the widget has been added to a widget hierarchy with a- Gtk.Windowat the top.- In general, you should only create display specific resources when a widget has been realized, and you should free those resources when the widget is unrealized. - New in version 2.2. 
 - 
get_double_buffered()[source]¶
- Returns: - Trueif the widget is double buffered- Return type: - bool- Determines whether the widget is double buffered. - See - Gtk.Widget.set_double_buffered()- New in version 2.18. 
 - 
get_events()[source]¶
- Returns: - event mask for self - Return type: - int- Returns the event mask (see - Gdk.EventMask) for the widget. These are the events that the widget will receive.- Note: Internally, the widget event mask will be the logical OR of the event mask set through - Gtk.Widget.set_events() or- Gtk.Widget.add_events(), and the event mask necessary to cater for every- Gtk.EventControllercreated for the widget.
 - 
get_focus_on_click()[source]¶
- Returns: - Trueif the widget should grab focus when it is clicked with the mouse.- Return type: - bool- Returns whether the widget should grab focus when it is clicked with the mouse. See - Gtk.Widget.set_focus_on_click().- New in version 3.20. 
 - 
get_font_map()[source]¶
- Returns: - A - Pango.FontMap, or- None- Return type: - Pango.FontMapor- None- Gets the font map that has been set with - Gtk.Widget.set_font_map().- New in version 3.18. 
 - 
get_font_options()[source]¶
- Returns: - the - cairo.FontOptionsor- Noneif not set- Return type: - cairo.FontOptionsor- None- Returns the - cairo.FontOptionsused for Pango rendering. When not set, the defaults font options for the- Gdk.Screenwill be used.- New in version 3.18. 
 - 
get_frame_clock()[source]¶
- Returns: - a - Gdk.FrameClock, or- Noneif widget is unrealized- Return type: - Gdk.FrameClockor- None- Obtains the frame clock for a widget. The frame clock is a global “ticker” that can be used to drive animations and repaints. The most common reason to get the frame clock is to call - Gdk.FrameClock.get_frame_time(), in order to get a time to use for animating. For example you might record the start of the animation with an initial value from- Gdk.FrameClock.get_frame_time(), and then update the animation by calling- Gdk.FrameClock.get_frame_time() again during each repaint.- Gdk.FrameClock.request_phase() will result in a new frame on the clock, but won’t necessarily repaint any widgets. To repaint a widget, you have to use- Gtk.Widget.queue_draw() which invalidates the widget (thus scheduling it to receive a draw on the next frame).- Gtk.Widget.queue_draw() will also end up requesting a frame on the appropriate frame clock.- A widget’s frame clock will not change while the widget is mapped. Reparenting a widget (which implies a temporary unmap) can change the widget’s frame clock. - Unrealized widgets do not have a frame clock. - New in version 3.8. 
 - 
get_halign()[source]¶
- Returns: - the horizontal alignment of self - Return type: - Gtk.Align- Gets the value of the - Gtk.Widget- :halignproperty.- For backwards compatibility reasons this method will never return - Gtk.Align.BASELINE, but instead it will convert it to- Gtk.Align.FILL. Baselines are not supported for horizontal alignment.
 - 
get_has_tooltip()[source]¶
- Returns: - current value of has-tooltip on self. - Return type: - bool- Returns the current value of the has-tooltip property. See - Gtk.Widget- :has-tooltipfor more information.- New in version 2.12. 
 - 
get_has_window()[source]¶
- Returns: - Trueif self has a window,- Falseotherwise- Return type: - bool- Determines whether self has a - Gdk.Windowof its own. See- Gtk.Widget.set_has_window().- New in version 2.18. 
 - 
get_hexpand()[source]¶
- Returns: - whether hexpand flag is set - Return type: - bool- Gets whether the widget would like any available extra horizontal space. When a user resizes a - Gtk.Window, widgets with expand=:obj:True generally receive the extra space. For example, a list or scrollable area or document in your window would often be set to expand.- Containers should use - Gtk.Widget.compute_expand() rather than this function, to see whether a widget, or any of its children, has the expand flag set. If any child of a widget wants to expand, the parent may ask to expand also.- This function only looks at the widget’s own hexpand flag, rather than computing whether the entire widget tree rooted at this widget wants to expand. 
 - 
get_hexpand_set()[source]¶
- Returns: - whether hexpand has been explicitly set - Return type: - bool- Gets whether - Gtk.Widget.set_hexpand() has been used to explicitly set the expand flag on this widget.- If hexpand is set, then it overrides any computed expand value based on child widgets. If hexpand is not set, then the expand value depends on whether any children of the widget would like to expand. - There are few reasons to use this function, but it’s here for completeness and consistency. 
 - 
get_mapped()[source]¶
- Returns: - Trueif the widget is mapped,- Falseotherwise.- Return type: - bool- Whether the widget is mapped. - New in version 2.20. 
 - 
get_margin_bottom()[source]¶
- Returns: - The bottom margin of self - Return type: - int- Gets the value of the - Gtk.Widget- :margin-bottomproperty.- New in version 3.0. 
 - 
get_margin_end()[source]¶
- Returns: - The end margin of self - Return type: - int- Gets the value of the - Gtk.Widget- :margin-endproperty.- New in version 3.12. 
 - 
get_margin_left()[source]¶
- Returns: - The left margin of self - Return type: - int- Gets the value of the - Gtk.Widget- :margin-leftproperty.- New in version 3.0. - Deprecated since version 3.12: Use - Gtk.Widget.get_margin_start() instead.
 - 
get_margin_right()[source]¶
- Returns: - The right margin of self - Return type: - int- Gets the value of the - Gtk.Widget- :margin-rightproperty.- New in version 3.0. - Deprecated since version 3.12: Use - Gtk.Widget.get_margin_end() instead.
 - 
get_margin_start()[source]¶
- Returns: - The start margin of self - Return type: - int- Gets the value of the - Gtk.Widget- :margin-startproperty.- New in version 3.12. 
 - 
get_margin_top()[source]¶
- Returns: - The top margin of self - Return type: - int- Gets the value of the - Gtk.Widget- :margin-topproperty.- New in version 3.0. 
 - 
get_modifier_mask(intent)[source]¶
- Parameters: - intent ( - Gdk.ModifierIntent) – the use case for the modifier mask- Returns: - the modifier mask used for intent. - Return type: - Gdk.ModifierType- Returns the modifier mask the self’s windowing system backend uses for a particular purpose. - See - Gdk.Keymap.get_modifier_mask().- New in version 3.4. 
 - 
get_modifier_style()[source]¶
- Returns: - the modifier style for the widget. This rc style is owned by the widget. If you want to keep a pointer to value this around, you must add a refcount using - GObject.Object.ref().- Return type: - Gtk.RcStyle- Returns the current modifier style for the widget. (As set by - Gtk.Widget.modify_style().) If no style has previously set, a new- Gtk.RcStylewill be created with all values unset, and set as the modifier style for the widget. If you make changes to this rc style, you must call- Gtk.Widget.modify_style(), passing in the returned rc style, to make sure that your changes take effect.- Caution: passing the style back to - Gtk.Widget.modify_style() will normally end up destroying it, because- Gtk.Widget.modify_style() copies the passed-in style and sets the copy as the new modifier style, thus dropping any reference to the old modifier style. Add a reference to the modifier style if you want to keep it alive.- Deprecated since version 3.0: Use - Gtk.StyleContextwith a custom- Gtk.StyleProviderinstead
 - 
get_name()[source]¶
- Returns: - name of the widget. This string is owned by GTK+ and should not be modified or freed - Return type: - str- Retrieves the name of a widget. See - Gtk.Widget.set_name() for the significance of widget names.
 - 
get_no_show_all()[source]¶
- Returns: - the current value of the “no-show-all” property. - Return type: - bool- Returns the current value of the - Gtk.Widget- :no-show-allproperty, which determines whether calls to- Gtk.Widget.show_all() will affect this widget.- New in version 2.4. 
 - 
get_opacity()[source]¶
- Returns: - the requested opacity for this widget. - Return type: - float- Fetches the requested opacity for this widget. See - Gtk.Widget.set_opacity().- New in version 3.8. 
 - 
get_pango_context()[source]¶
- Returns: - the - Pango.Contextfor the widget.- Return type: - Pango.Context- Gets a - Pango.Contextwith the appropriate font map, font description, and base direction for this widget. Unlike the context returned by- Gtk.Widget.create_pango_context(), this context is owned by the widget (it can be used until the screen for the widget changes or the widget is removed from its toplevel), and will be updated to match any changes to the widget’s attributes. This can be tracked by using the- Gtk.Widget- ::screen-changedsignal on the widget.
 - 
get_parent()[source]¶
- Returns: - the parent container of self, or - None- Return type: - Gtk.Widgetor- None- Returns the parent container of self. 
 - 
get_parent_window()[source]¶
- Returns: - the parent window of self, or - Noneif it does not have a parent window.- Return type: - Gdk.Windowor- None- Gets self’s parent window, or - Noneif it does not have one.
 - 
get_path()[source]¶
- Returns: - The - Gtk.WidgetPathrepresenting self- Return type: - Gtk.WidgetPath- Returns the - Gtk.WidgetPathrepresenting self, if the widget is not connected to a toplevel widget, a partial path will be created.
 - 
get_pointer()[source]¶
- Returns: - x: - return location for the X coordinate, or - None- y: - return location for the Y coordinate, or - None- Return type: - (x: - int, y:- int)- Obtains the location of the mouse pointer in widget coordinates. Widget coordinates are a bit odd; for historical reasons, they are defined as self->window coordinates for widgets that return - Truefor- Gtk.Widget.get_has_window(); and are relative to self->allocation.x, self->allocation.y otherwise.- Deprecated since version 3.4: Use - Gdk.Window.get_device_position() instead.
 - 
get_preferred_height()[source]¶
- Returns: - minimum_height: - location to store the minimum height, or - None- natural_height: - location to store the natural height, or - None- Return type: - (minimum_height: - int, natural_height:- int)- Retrieves a widget’s initial minimum and natural height. - This call is specific to width-for-height requests. - The returned request will be modified by the GtkWidgetClass::adjust_size_request virtual method and by any - Gtk.SizeGroupsthat have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.- New in version 3.0. 
 - 
get_preferred_height_and_baseline_for_width(width)[source]¶
- Parameters: - width ( - int) – the width which is available for allocation, or -1 if none- Returns: - minimum_height: - location for storing the minimum height, or - None- natural_height: - location for storing the natural height, or - None- minimum_baseline: - location for storing the baseline for the minimum height, or - None- natural_baseline: - location for storing the baseline for the natural height, or - None- Return type: - (minimum_height: - int, natural_height:- int, minimum_baseline:- int, natural_baseline:- int)- Retrieves a widget’s minimum and natural height and the corresponding baselines if it would be given the specified width, or the default height if width is -1. The baselines may be -1 which means that no baseline is requested for this widget. - The returned request will be modified by the GtkWidgetClass::adjust_size_request and GtkWidgetClass::adjust_baseline_request virtual methods and by any - Gtk.SizeGroupsthat have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.- New in version 3.10. 
 - 
get_preferred_height_for_width(width)[source]¶
- Parameters: - width ( - int) – the width which is available for allocation- Returns: - minimum_height: - location for storing the minimum height, or - None- natural_height: - location for storing the natural height, or - None- Return type: - (minimum_height: - int, natural_height:- int)- Retrieves a widget’s minimum and natural height if it would be given the specified width. - The returned request will be modified by the GtkWidgetClass::adjust_size_request virtual method and by any - Gtk.SizeGroupsthat have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.- New in version 3.0. 
 - 
get_preferred_size()[source]¶
- Returns: - minimum_size: - location for storing the minimum size, or - None- natural_size: - location for storing the natural size, or - None- Return type: - (minimum_size: - Gtk.Requisition, natural_size:- Gtk.Requisition)- Retrieves the minimum and natural size of a widget, taking into account the widget’s preference for height-for-width management. - This is used to retrieve a suitable size by container widgets which do not impose any restrictions on the child placement. It can be used to deduce toplevel window and menu sizes as well as child widgets in free-form containers such as - Gtk.Layout.- Handle with care. Note that the natural height of a height-for-width widget will generally be a smaller size than the minimum height, since the required height for the natural width is generally smaller than the required height for the minimum width. - Use - Gtk.Widget.get_preferred_height_and_baseline_for_width() if you want to support baseline alignment.- New in version 3.0. 
 - 
get_preferred_width()[source]¶
- Returns: - minimum_width: - location to store the minimum width, or - None- natural_width: - location to store the natural width, or - None- Return type: - (minimum_width: - int, natural_width:- int)- Retrieves a widget’s initial minimum and natural width. - This call is specific to height-for-width requests. - The returned request will be modified by the GtkWidgetClass::adjust_size_request virtual method and by any - Gtk.SizeGroupsthat have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.- New in version 3.0. 
 - 
get_preferred_width_for_height(height)[source]¶
- Parameters: - height ( - int) – the height which is available for allocation- Returns: - minimum_width: - location for storing the minimum width, or - None- natural_width: - location for storing the natural width, or - None- Return type: - (minimum_width: - int, natural_width:- int)- Retrieves a widget’s minimum and natural width if it would be given the specified height. - The returned request will be modified by the GtkWidgetClass::adjust_size_request virtual method and by any - Gtk.SizeGroupsthat have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.- New in version 3.0. 
 - 
get_realized()[source]¶
- Returns: - Trueif self is realized,- Falseotherwise- Return type: - bool- Determines whether self is realized. - New in version 2.20. 
 - 
get_receives_default()[source]¶
- Returns: - Trueif self acts as the default widget when focused,- Falseotherwise- Return type: - bool- Determines whether self is always treated as the default widget within its toplevel when it has the focus, even if another widget is the default. - See - Gtk.Widget.set_receives_default().- New in version 2.18. 
 - 
get_request_mode()[source]¶
- Returns: - The - Gtk.SizeRequestModepreferred by self.- Return type: - Gtk.SizeRequestMode- Gets whether the widget prefers a height-for-width layout or a width-for-height layout. - Gtk.Binwidgets generally propagate the preference of their child, container widgets need to request something either in context of their children or in context of their allocation capabilities.- New in version 3.0. 
 - 
get_requisition()[source]¶
- Returns: - a pointer to a - Gtk.Requisitionto copy to- Return type: - requisition: - Gtk.Requisition- Retrieves the widget’s requisition. - This function should only be used by widget implementations in order to figure whether the widget’s requisition has actually changed after some internal state change (so that they can call - Gtk.Widget.queue_resize() instead of- Gtk.Widget.queue_draw()).- Normally, - Gtk.Widget.size_request() should be used.- New in version 2.20. - Deprecated since version 3.0: The - Gtk.Requisitioncache on the widget was removed, If you need to cache sizes across requests and allocations, add an explicit cache to the widget in question instead.
 - 
get_root_window()[source]¶
- Returns: - the - Gdk.Windowroot window for the toplevel for this widget.- Return type: - Gdk.Window- Get the root window where this widget is located. This function can only be called after the widget has been added to a widget hierarchy with - Gtk.Windowat the top.- The root window is useful for such purposes as creating a popup - Gdk.Windowassociated with the window. In general, you should only create display specific resources when a widget has been realized, and you should free those resources when the widget is unrealized.- New in version 2.2. - Deprecated since version 3.12: Use - Gdk.Screen.get_root_window() instead
 - 
get_scale_factor()[source]¶
- Returns: - the scale factor for self - Return type: - int- Retrieves the internal scale factor that maps from window coordinates to the actual device pixels. On traditional systems this is 1, on high density outputs, it can be a higher value (typically 2). - See - Gdk.Window.get_scale_factor().- New in version 3.10. 
 - 
get_screen()[source]¶
- Returns: - the - Gdk.Screenfor the toplevel for this widget.- Return type: - Gdk.Screen- Get the - Gdk.Screenfrom the toplevel window associated with this widget. This function can only be called after the widget has been added to a widget hierarchy with a- Gtk.Windowat the top.- In general, you should only create screen specific resources when a widget has been realized, and you should free those resources when the widget is unrealized. - New in version 2.2. 
 - 
get_sensitive()[source]¶
- Returns: - Trueif the widget is sensitive- Return type: - bool- Returns the widget’s sensitivity (in the sense of returning the value that has been set using - Gtk.Widget.set_sensitive()).- The effective sensitivity of a widget is however determined by both its own and its parent widget’s sensitivity. See - Gtk.Widget.is_sensitive().- New in version 2.18. 
 - 
get_settings()[source]¶
- Returns: - the relevant - Gtk.Settingsobject- Return type: - Gtk.Settings- Gets the settings object holding the settings used for this widget. - Note that this function can only be called when the - Gtk.Widgetis attached to a toplevel, since the settings object is specific to a particular- Gdk.Screen.
 - 
get_size_request()[source]¶
- Returns: - width: - return location for width, or - None- height: - return location for height, or - None- Return type: - (width: - int, height:- int)- Gets the size request that was explicitly set for the widget using - Gtk.Widget.set_size_request(). A value of -1 stored in width or height indicates that that dimension has not been set explicitly and the natural requisition of the widget will be used instead. See- Gtk.Widget.set_size_request(). To get the size a widget will actually request, call- Gtk.Widget.get_preferred_size() instead of this function.
 - 
get_state()[source]¶
- Returns: - the state of self. - Return type: - Gtk.StateType- Returns the widget’s state. See - Gtk.Widget.set_state().- New in version 2.18. - Deprecated since version 3.0: Use - Gtk.Widget.get_state_flags() instead.
 - 
get_state_flags()[source]¶
- Returns: - The state flags for widget - Return type: - Gtk.StateFlags- Returns the widget state as a flag set. It is worth mentioning that the effective - Gtk.StateFlags.INSENSITIVEstate will be returned, that is, also based on parent insensitivity, even if self itself is sensitive.- Also note that if you are looking for a way to obtain the - Gtk.StateFlagsto pass to a- Gtk.StyleContextmethod, you should look at- Gtk.StyleContext.get_state().- New in version 3.0. 
 - 
get_style()[source]¶
- Returns: - the widget’s - Gtk.Style- Return type: - Gtk.Style- Simply an accessor function that returns self->style. - Deprecated since version 3.0: Use - Gtk.StyleContextinstead
 - 
get_style_context()[source]¶
- Returns: - a - Gtk.StyleContext. This memory is owned by self and must not be freed.- Return type: - Gtk.StyleContext- Returns the style context associated to self. The returned object is guaranteed to be the same for the lifetime of self. 
 - 
get_support_multidevice()[source]¶
- Returns: - Trueif self is multidevice aware.- Return type: - bool- Returns - Trueif self is multiple pointer aware. See- Gtk.Widget.set_support_multidevice() for more information.
 - 
get_template_child(widget_type, name)[source]¶
- Parameters: - widget_type (GObject.GType) – TheGObject.GTypeto get a template child for
- name (str) – The “id” of the child defined in the template XML
 - Returns: - The object built in the template XML with the id name - Return type: - Fetch an object build from the template XML for widget_type in this self instance. - This will only report children which were previously declared with - Gtk.WidgetClass.bind_template_child_full() or one of its variants.- This function is only meant to be called for code which is private to the widget_type which declared the child and is meant for language bindings which cannot easily make use of the - GObject.Objectstructure offsets.
- widget_type (
 - 
get_tooltip_markup()[source]¶
- Returns: - the tooltip text, or - None. You should free the returned string with- GLib.free() when done.- Return type: - stror- None- Gets the contents of the tooltip for self. - New in version 2.12. 
 - 
get_tooltip_text()[source]¶
- Returns: - the tooltip text, or - None. You should free the returned string with- GLib.free() when done.- Return type: - stror- None- Gets the contents of the tooltip for self. - New in version 2.12. 
 - 
get_tooltip_window()[source]¶
- Returns: - The - Gtk.Windowof the current tooltip.- Return type: - Gtk.Window- Returns the - Gtk.Windowof the current tooltip. This can be the- Gtk.Windowcreated by default, or the custom tooltip window set using- Gtk.Widget.set_tooltip_window().- New in version 2.12. 
 - 
get_toplevel()[source]¶
- Returns: - the topmost ancestor of self, or self itself if there’s no ancestor. - Return type: - Gtk.Widget- This function returns the topmost widget in the container hierarchy self is a part of. If self has no parent widgets, it will be returned as the topmost widget. No reference will be added to the returned widget; it should not be unreferenced. - Note the difference in behavior vs. - Gtk.Widget.get_ancestor();- gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW)would return- Noneif self wasn’t inside a toplevel window, and if the window was inside a- Gtk.Window-derived widget which was in turn inside the toplevel- Gtk.Window. While the second case may seem unlikely, it actually happens when a- Gtk.Plugis embedded inside a- Gtk.Socketwithin the same application.- To reliably find the toplevel - Gtk.Window, use- Gtk.Widget.get_toplevel() and call GTK_IS_WINDOW() on the result. For instance, to get the title of a widget’s toplevel window, one might use:- static const char * get_widget_toplevel_title (GtkWidget *widget) { GtkWidget *toplevel = gtk_widget_get_toplevel (widget); if (GTK_IS_WINDOW (toplevel)) { return gtk_window_get_title (GTK_WINDOW (toplevel)); } return NULL; } 
 - 
get_valign()[source]¶
- Returns: - the vertical alignment of self, ignoring baseline alignment - Return type: - Gtk.Align- Gets the value of the - Gtk.Widget- :valignproperty.- For backwards compatibility reasons this method will never return - Gtk.Align.BASELINE, but instead it will convert it to- Gtk.Align.FILL. If your widget want to support baseline aligned children it must use- Gtk.Widget.get_valign_with_baseline(), or- g_object_get (widget, "valign", &value, NULL), which will also report the true value.
 - 
get_valign_with_baseline()[source]¶
- Returns: - the vertical alignment of self - Return type: - Gtk.Align- Gets the value of the - Gtk.Widget- :valignproperty, including- Gtk.Align.BASELINE.- New in version 3.10. 
 - 
get_vexpand()[source]¶
- Returns: - whether vexpand flag is set - Return type: - bool- Gets whether the widget would like any available extra vertical space. - See - Gtk.Widget.get_hexpand() for more detail.
 - 
get_vexpand_set()[source]¶
- Returns: - whether vexpand has been explicitly set - Return type: - bool- Gets whether - Gtk.Widget.set_vexpand() has been used to explicitly set the expand flag on this widget.- See - Gtk.Widget.get_hexpand_set() for more detail.
 - 
get_visible()[source]¶
- Returns: - Trueif the widget is visible- Return type: - bool- Determines whether the widget is visible. If you want to take into account whether the widget’s parent is also marked as visible, use - Gtk.Widget.is_visible() instead.- This function does not check if the widget is obscured in any way. - See - Gtk.Widget.set_visible().- New in version 2.18. 
 - 
get_visual()[source]¶
- Returns: - the visual for self - Return type: - Gdk.Visual- Gets the visual that will be used to render self. 
 - 
get_window()[source]¶
- Returns: - self’s window. - Return type: - Gdk.Windowor- None- Returns the widget’s window if it is realized, - Noneotherwise- New in version 2.14. 
 - 
grab_add()[source]¶
- Makes self the current grabbed widget. - This means that interaction with other widgets in the same application is blocked and mouse as well as keyboard events are delivered to this widget. - If self is not sensitive, it is not set as the current grabbed widget and this function does nothing. 
 - 
grab_default()[source]¶
- Causes self to become the default widget. self must be able to be a default widget; typically you would ensure this yourself by calling - Gtk.Widget.set_can_default() with a- Truevalue. The default widget is activated when the user presses Enter in a window. Default widgets must be activatable, that is,- Gtk.Widget.activate() should affect them. Note that- Gtk.Entrywidgets require the “activates-default” property set to- Truebefore they activate the default widget when Enter is pressed and the- Gtk.Entryis focused.
 - 
grab_focus()[source]¶
- Causes self to have the keyboard focus for the - Gtk.Windowit’s inside. self must be a focusable widget, such as a- Gtk.Entry; something like- Gtk.Framewon’t work.- More precisely, it must have the %GTK_CAN_FOCUS flag set. Use - Gtk.Widget.set_can_focus() to modify that flag.- The widget also needs to be realized and mapped. This is indicated by the related signals. Grabbing the focus immediately after creating the widget will likely fail and cause critical warnings. 
 - 
grab_remove()[source]¶
- Removes the grab from the given widget. - You have to pair calls to - Gtk.Widget.grab_add() and- Gtk.Widget.grab_remove().- If self does not have the grab, this function does nothing. 
 - 
has_default()[source]¶
- Returns: - Trueif self is the current default widget within its toplevel,- Falseotherwise- Return type: - bool- Determines whether self is the current default widget within its toplevel. See - Gtk.Widget.set_can_default().- New in version 2.18. 
 - 
has_focus()[source]¶
- Returns: - Trueif the widget has the global input focus.- Return type: - bool- Determines if the widget has the global input focus. See - Gtk.Widget.is_focus() for the difference between having the global input focus, and only having the focus within a toplevel.- New in version 2.18. 
 - 
has_grab()[source]¶
- Returns: - Trueif the widget is in the grab_widgets stack- Return type: - bool- Determines whether the widget is currently grabbing events, so it is the only widget receiving input events (keyboard and mouse). - See also - Gtk.Widget.grab_add().- New in version 2.18. 
 - 
has_rc_style()[source]¶
- Returns: - Trueif the widget has been looked up through the rc mechanism,- Falseotherwise.- Return type: - bool- Determines if the widget style has been looked up through the rc mechanism. - New in version 2.20. - Deprecated since version 3.0: Use - Gtk.StyleContextinstead
 - 
has_screen()[source]¶
- Returns: - Trueif there is a- Gdk.Screenassociated with the widget.- Return type: - bool- Checks whether there is a - Gdk.Screenis associated with this widget. All toplevel widgets have an associated screen, and all widgets added into a hierarchy with a toplevel window at the top.- New in version 2.2. 
 - 
has_visible_focus()[source]¶
- Returns: - Trueif the widget should display a “focus rectangle”- Return type: - bool- Determines if the widget should show a visible indication that it has the global input focus. This is a convenience function for use in - ::drawhandlers that takes into account whether focus indication should currently be shown in the toplevel window of self. See- Gtk.Window.get_focus_visible() for more information about focus indication.- To find out if the widget has the global input focus, use - Gtk.Widget.has_focus().- New in version 3.2. 
 - 
hide()[source]¶
- Reverses the effects of - Gtk.Widget.show(), causing the widget to be hidden (invisible to the user).
 - 
hide_on_delete()[source]¶
- Returns: - True- Return type: - bool- Utility function; intended to be connected to the - Gtk.Widget- ::delete-eventsignal on a- Gtk.Window. The function calls- Gtk.Widget.hide() on its argument, then returns- True. If connected to- ::delete-event, the result is that clicking the close button for a window (on the window frame, top right corner usually) will hide but not destroy the window. By default, GTK+ destroys windows when- ::delete-eventis received.
 - 
in_destruction()[source]¶
- Returns: - Trueif self is being destroyed- Return type: - bool- Returns whether the widget is currently being destroyed. This information can sometimes be used to avoid doing unnecessary work. 
 - 
init_template()[source]¶
- Creates and initializes child widgets defined in templates. This function must be called in the instance initializer for any class which assigned itself a template using - Gtk.WidgetClass.set_template()- It is important to call this function in the instance initializer of a - Gtk.Widgetsubclass and not in- GObject.Object.do_constructed() or- GObject.Object.do_constructor() for two reasons.- One reason is that generally derived widgets will assume that parent class composite widgets have been created in their instance initializers. - Another reason is that when calling g_object_new() on a widget with composite templates, it’s important to build the composite widgets before the construct properties are set. Properties passed to g_object_new() should take precedence over properties set in the private template XML. - New in version 3.10. 
 - 
input_shape_combine_region(region)[source]¶
- Parameters: - region ( - cairo.Regionor- None) – shape to be added, or- Noneto remove an existing shape- Sets an input shape for this widget’s GDK window. This allows for windows which react to mouse click in a nonrectangular region, see - Gdk.Window.input_shape_combine_region() for more information.- New in version 3.0. 
 - 
insert_action_group(name, group)[source]¶
- Parameters: - name (str) – the prefix for actions in group
- group (Gio.ActionGrouporNone) – aGio.ActionGroup, orNone
 - Inserts group into self. Children of self that implement - Gtk.Actionablecan then be associated with actions in group by setting their “action-name” to prefix.``action-name``.- If group is - None, a previously inserted group for name is removed from self.- New in version 3.6. 
- name (
 - 
intersect(area)[source]¶
- Parameters: - area ( - Gdk.Rectangle) – a rectangle- Returns: - Trueif there was an intersection- intersection: - rectangle to store intersection of self and area - Return type: - ( - bool, intersection:- Gdk.Rectangle)- Computes the intersection of a self’s area and area, storing the intersection in intersection, and returns - Trueif there was an intersection. intersection may be- Noneif you’re only interested in whether there was an intersection.
 - 
is_ancestor(ancestor)[source]¶
- Parameters: - ancestor ( - Gtk.Widget) – another- Gtk.Widget- Returns: - Trueif ancestor contains self as a child, grandchild, great grandchild, etc.- Return type: - bool- Determines whether self is somewhere inside ancestor, possibly with intermediate containers. 
 - 
is_composited()[source]¶
- Returns: - Trueif the widget can rely on its alpha channel being drawn correctly.- Return type: - bool- Whether self can rely on having its alpha channel drawn correctly. On X11 this function returns whether a compositing manager is running for self’s screen. - Please note that the semantics of this call will change in the future if used on a widget that has a composited window in its hierarchy (as set by - Gdk.Window.set_composited()).- New in version 2.10. - Deprecated since version 3.22: Use - Gdk.Screen.is_composited() instead.
 - 
is_drawable()[source]¶
- Returns: - Trueif self is drawable,- Falseotherwise- Return type: - bool- Determines whether self can be drawn to. A widget can be drawn to if it is mapped and visible. - New in version 2.18. 
 - 
is_focus()[source]¶
- Returns: - Trueif the widget is the focus widget.- Return type: - bool- Determines if the widget is the focus widget within its toplevel. (This does not mean that the - Gtk.Widget- :has-focusproperty is necessarily set;- Gtk.Widget- :has-focuswill only be set if the toplevel widget additionally has the global input focus.)
 - 
is_sensitive()[source]¶
- Returns: - Trueif the widget is effectively sensitive- Return type: - bool- Returns the widget’s effective sensitivity, which means it is sensitive itself and also its parent widget is sensitive - New in version 2.18. 
 - 
is_toplevel()[source]¶
- Returns: - Trueif self is a toplevel,- Falseotherwise- Return type: - bool- Determines whether self is a toplevel widget. - Currently only - Gtk.Windowand- Gtk.Invisible(and out-of-process- Gtk.Plugs) are toplevel widgets. Toplevel widgets have no parent widget.- New in version 2.18. 
 - 
is_visible()[source]¶
- Returns: - Trueif the widget and all its parents are visible- Return type: - bool- Determines whether the widget and all its parents are marked as visible. - This function does not check if the widget is obscured in any way. - See also - Gtk.Widget.get_visible() and- Gtk.Widget.set_visible()- New in version 3.8. 
 - Parameters: - direction ( - Gtk.DirectionType) – direction of focus movement- Returns: - Trueif stopping keyboard navigation is fine,- Falseif the emitting widget should try to handle the keyboard navigation attempt in its parent container(s).- Return type: - bool- This function should be called whenever keyboard navigation within a single widget hits a boundary. The function emits the - Gtk.Widget- ::keynav-failedsignal on the widget and its return value should be interpreted in a way similar to the return value of- Gtk.Widget.child_focus():- When - Trueis returned, stay in the widget, the failed keyboard navigation is OK and/or there is nowhere we can/should move the focus to.- When - Falseis returned, the caller should continue with keyboard navigation outside the widget, e.g. by calling- Gtk.Widget.child_focus() on the widget’s toplevel.- The default - ::keynav-failedhandler returns- Falsefor- Gtk.DirectionType.TAB_FORWARDand- Gtk.DirectionType.TAB_BACKWARD. For the other values of- Gtk.DirectionTypeit returns- True.- Whenever the default handler returns - True, it also calls- Gtk.Widget.error_bell() to notify the user of the failed keyboard navigation.- A use case for providing an own implementation of - ::keynav-failed(either by connecting to it or by overriding it) would be a row of- Gtk.Entrywidgets where the user should be able to navigate the entire row with the cursor keys, as e.g. known from user interfaces that require entering license keys.- New in version 2.12. 
 - 
list_accel_closures()[source]¶
- Returns: - a newly allocated - GLib.Listof closures- Return type: - [ - GObject.Closure]- Lists the closures used by self for accelerator group connections with - Gtk.AccelGroup.connect_by_path() or- Gtk.AccelGroup.connect(). The closures can be used to monitor accelerator changes on self, by connecting to the GtkAccelGroup- ::accel-changedsignal of the- Gtk.AccelGroupof a closure which can be found out with- Gtk.AccelGroup.from_accel_closure().
 - 
list_action_prefixes()[source]¶
- Returns: - a - None-terminated array of strings.- Return type: - [ - str]- Retrieves a - None-terminated array of strings containing the prefixes of- Gio.ActionGroup’s available to self.- New in version 3.16. 
 - 
list_mnemonic_labels()[source]¶
- Returns: - the list of mnemonic labels; free this list with g_list_free() when you are done with it. - Return type: - [ - Gtk.Widget]- Returns a newly allocated list of the widgets, normally labels, for which this widget is the target of a mnemonic (see for example, - Gtk.Label.set_mnemonic_widget()).- The widgets in the list are not individually referenced. If you want to iterate through the list and perform actions involving callbacks that might destroy the widgets, you must call - g_list_foreach (result, (GFunc)g_object_ref, NULL)first, and then unref all the widgets afterwards.- New in version 2.4. 
 - 
map()[source]¶
- This function is only for use in widget implementations. Causes a widget to be mapped if it isn’t already. 
 - 
mnemonic_activate(group_cycling)[source]¶
- Parameters: - group_cycling ( - bool) –- Trueif there are other widgets with the same mnemonic- Returns: - Trueif the signal has been handled- Return type: - bool- Emits the - Gtk.Widget- ::mnemonic-activatesignal.
 - 
modify_base(state, color)[source]¶
- Parameters: - state (Gtk.StateType) – the state for which to set the base color
- color (Gdk.ColororNone) – the color to assign (does not need to be allocated), orNoneto undo the effect of previous calls to ofGtk.Widget.modify_base().
 - Sets the base color for a widget in a particular state. All other style values are left untouched. The base color is the background color used along with the text color (see - Gtk.Widget.modify_text()) for widgets such as- Gtk.Entryand- Gtk.TextView. See also- Gtk.Widget.modify_style().- Note that “no window” widgets (which have the %GTK_NO_WINDOW flag set) draw on their parent container’s window and thus may not draw any background themselves. This is the case for e.g. - Gtk.Label.- To modify the background of such widgets, you have to set the base color on their parent; if you want to set the background of a rectangular area around a label, try placing the label in a - Gtk.EventBoxwidget and setting the base color on that.- Deprecated since version 3.0: Use - Gtk.Widget.override_background_color() instead
- state (
 - 
modify_bg(state, color)[source]¶
- Parameters: - state (Gtk.StateType) – the state for which to set the background color
- color (Gdk.ColororNone) – the color to assign (does not need to be allocated), orNoneto undo the effect of previous calls to ofGtk.Widget.modify_bg().
 - Sets the background color for a widget in a particular state. - All other style values are left untouched. See also - Gtk.Widget.modify_style().- Note that “no window” widgets (which have the %GTK_NO_WINDOW flag set) draw on their parent container’s window and thus may not draw any background themselves. This is the case for e.g. - Gtk.Label.- To modify the background of such widgets, you have to set the background color on their parent; if you want to set the background of a rectangular area around a label, try placing the label in a - Gtk.EventBoxwidget and setting the background color on that.- Deprecated since version 3.0: Use - Gtk.Widget.override_background_color() instead
- state (
 - 
modify_cursor(primary, secondary)[source]¶
- Parameters: - primary (Gdk.ColororNone) – the color to use for primary cursor (does not need to be allocated), orNoneto undo the effect of previous calls to ofGtk.Widget.modify_cursor().
- secondary (Gdk.ColororNone) – the color to use for secondary cursor (does not need to be allocated), orNoneto undo the effect of previous calls to ofGtk.Widget.modify_cursor().
 - Sets the cursor color to use in a widget, overriding the - Gtk.Widgetcursor-color and secondary-cursor-color style properties.- All other style values are left untouched. See also - Gtk.Widget.modify_style().- New in version 2.12. - Deprecated since version 3.0: Use - Gtk.Widget.override_cursor() instead.
- primary (
 - 
modify_fg(state, color)[source]¶
- Parameters: - state (Gtk.StateType) – the state for which to set the foreground color
- color (Gdk.ColororNone) – the color to assign (does not need to be allocated), orNoneto undo the effect of previous calls to ofGtk.Widget.modify_fg().
 - Sets the foreground color for a widget in a particular state. - All other style values are left untouched. See also - Gtk.Widget.modify_style().- Deprecated since version 3.0: Use - Gtk.Widget.override_color() instead
- state (
 - 
modify_font(font_desc)[source]¶
- Parameters: - font_desc ( - Pango.FontDescriptionor- None) – the font description to use, or- Noneto undo the effect of previous calls to- Gtk.Widget.modify_font()- Sets the font to use for a widget. - All other style values are left untouched. See also - Gtk.Widget.modify_style().- Deprecated since version 3.0: Use - Gtk.Widget.override_font() instead
 - 
modify_style(style)[source]¶
- Parameters: - style ( - Gtk.RcStyle) – the- Gtk.RcStyle-struct holding the style modifications- Modifies style values on the widget. - Modifications made using this technique take precedence over style values set via an RC file, however, they will be overridden if a style is explicitly set on the widget using - Gtk.Widget.set_style(). The- Gtk.RcStyle-struct is designed so each field can either be set or unset, so it is possible, using this function, to modify some style values and leave the others unchanged.- Note that modifications made with this function are not cumulative with previous calls to - Gtk.Widget.modify_style() or with such functions as- Gtk.Widget.modify_fg(). If you wish to retain previous values, you must first call- Gtk.Widget.get_modifier_style(), make your modifications to the returned style, then call- Gtk.Widget.modify_style() with that style. On the other hand, if you first call- Gtk.Widget.modify_style(), subsequent calls to such functions- Gtk.Widget.modify_fg() will have a cumulative effect with the initial modifications.- Deprecated since version 3.0: Use - Gtk.StyleContextwith a custom- Gtk.StyleProviderinstead
 - 
modify_text(state, color)[source]¶
- Parameters: - state (Gtk.StateType) – the state for which to set the text color
- color (Gdk.ColororNone) – the color to assign (does not need to be allocated), orNoneto undo the effect of previous calls to ofGtk.Widget.modify_text().
 - Sets the text color for a widget in a particular state. - All other style values are left untouched. The text color is the foreground color used along with the base color (see - Gtk.Widget.modify_base()) for widgets such as- Gtk.Entryand- Gtk.TextView. See also- Gtk.Widget.modify_style().- Deprecated since version 3.0: Use - Gtk.Widget.override_color() instead
- state (
 - 
override_background_color(state, color)[source]¶
- Parameters: - state (Gtk.StateFlags) – the state for which to set the background color
- color (Gdk.RGBAorNone) – the color to assign, orNoneto undo the effect of previous calls toGtk.Widget.override_background_color()
 - Sets the background color to use for a widget. - All other style values are left untouched. See - Gtk.Widget.override_color().- New in version 3.0. - Deprecated since version 3.16: This function is not useful in the context of CSS-based rendering. If you wish to change the way a widget renders its background you should use a custom CSS style, through an application-specific - Gtk.StyleProviderand a CSS style class. You can also override the default drawing of a widget through the- Gtk.Widget- ::drawsignal, and use Cairo to draw a specific color, regardless of the CSS style.
- state (
 - 
override_color(state, color)[source]¶
- Parameters: - state (Gtk.StateFlags) – the state for which to set the color
- color (Gdk.RGBAorNone) – the color to assign, orNoneto undo the effect of previous calls toGtk.Widget.override_color()
 - Sets the color to use for a widget. - All other style values are left untouched. - This function does not act recursively. Setting the color of a container does not affect its children. Note that some widgets that you may not think of as containers, for instance - Gtk.Buttons, are actually containers.- This API is mostly meant as a quick way for applications to change a widget appearance. If you are developing a widgets library and intend this change to be themeable, it is better done by setting meaningful CSS classes in your widget/container implementation through - Gtk.StyleContext.add_class().- This way, your widget library can install a - Gtk.CssProviderwith the- Gtk.STYLE_PROVIDER_PRIORITY_FALLBACKpriority in order to provide a default styling for those widgets that need so, and this theming may fully overridden by the user’s theme.- Note that for complex widgets this may bring in undesired results (such as uniform background color everywhere), in these cases it is better to fully style such widgets through a - Gtk.CssProviderwith the- Gtk.STYLE_PROVIDER_PRIORITY_APPLICATIONpriority.- New in version 3.0. - Deprecated since version 3.16: Use a custom style provider and style classes instead 
- state (
 - 
override_cursor(cursor, secondary_cursor)[source]¶
- Parameters: - cursor (Gdk.RGBAorNone) – the color to use for primary cursor (does not need to be allocated), orNoneto undo the effect of previous calls to ofGtk.Widget.override_cursor().
- secondary_cursor (Gdk.RGBAorNone) – the color to use for secondary cursor (does not need to be allocated), orNoneto undo the effect of previous calls to ofGtk.Widget.override_cursor().
 - Sets the cursor color to use in a widget, overriding the cursor-color and secondary-cursor-color style properties. All other style values are left untouched. See also - Gtk.Widget.modify_style().- Note that the underlying properties have the - Gdk.Colortype, so the alpha value in primary and secondary will be ignored.- New in version 3.0. - Deprecated since version 3.16: This function is not useful in the context of CSS-based rendering. If you wish to change the color used to render the primary and secondary cursors you should use a custom CSS style, through an application-specific - Gtk.StyleProviderand a CSS style class.
- cursor (
 - 
override_font(font_desc)[source]¶
- Parameters: - font_desc ( - Pango.FontDescriptionor- None) – the font description to use, or- Noneto undo the effect of previous calls to- Gtk.Widget.override_font()- Sets the font to use for a widget. All other style values are left untouched. See - Gtk.Widget.override_color().- New in version 3.0. - Deprecated since version 3.16: This function is not useful in the context of CSS-based rendering. If you wish to change the font a widget uses to render its text you should use a custom CSS style, through an application-specific - Gtk.StyleProviderand a CSS style class.
 - 
override_symbolic_color(name, color)[source]¶
- Parameters: - name (str) – the name of the symbolic color to modify
- color (Gdk.RGBAorNone) – the color to assign (does not need to be allocated), orNoneto undo the effect of previous calls toGtk.Widget.override_symbolic_color()
 - Sets a symbolic color for a widget. - All other style values are left untouched. See - Gtk.Widget.override_color() for overriding the foreground or background color.- New in version 3.0. - Deprecated since version 3.16: This function is not useful in the context of CSS-based rendering. If you wish to change the color used to render symbolic icons you should use a custom CSS style, through an application-specific - Gtk.StyleProviderand a CSS style class.
- name (
 - 
path()[source]¶
- Returns: - path_length: - location to store length of the path, or - None- path: - location to store allocated path string, or - None- path_reversed: - location to store allocated reverse path string, or - None- Return type: - (path_length: - int, path:- str, path_reversed:- str)- Obtains the full path to self. The path is simply the name of a widget and all its parents in the container hierarchy, separated by periods. The name of a widget comes from - Gtk.Widget.get_name(). Paths are used to apply styles to a widget in gtkrc configuration files. Widget names are the type of the widget by default (e.g. “- Gtk.Button”) or can be set to an application-specific value with- Gtk.Widget.set_name(). By setting the name of a widget, you allow users or theme authors to apply styles to that specific widget in their gtkrc file. path_reversed_p fills in the path in reverse order, i.e. starting with self’s name instead of starting with the name of self’s outermost ancestor.- Deprecated since version 3.0: Use - Gtk.Widget.get_path() instead
 - 
queue_allocate()[source]¶
- This function is only for use in widget implementations. - Flags the widget for a rerun of the GtkWidgetClass::size_allocate function. Use this function instead of - Gtk.Widget.queue_resize() when the self’s size request didn’t change but it wants to reposition its contents.- An example user of this function is - Gtk.Widget.set_halign().- New in version 3.20. 
 - 
queue_compute_expand()[source]¶
- Mark self as needing to recompute its expand flags. Call this function when setting legacy expand child properties on the child of a container. - See - Gtk.Widget.compute_expand().
 - 
queue_draw()[source]¶
- Equivalent to calling - Gtk.Widget.queue_draw_area() for the entire area of a widget.
 - 
queue_draw_area(x, y, width, height)[source]¶
- Parameters: - Convenience function that calls - Gtk.Widget.queue_draw_region() on the region created from the given coordinates.- The region here is specified in widget coordinates. Widget coordinates are a bit odd; for historical reasons, they are defined as self->window coordinates for widgets that return - Truefor- Gtk.Widget.get_has_window(), and are relative to self->allocation.x, self->allocation.y otherwise.- width or height may be 0, in this case this function does nothing. Negative values for width and height are not allowed. 
 - 
queue_draw_region(region)[source]¶
- Parameters: - region ( - cairo.Region) – region to draw- Invalidates the area of self defined by region by calling - Gdk.Window.invalidate_region() on the widget’s window and all its child windows. Once the main loop becomes idle (after the current batch of events has been processed, roughly), the window will receive expose events for the union of all regions that have been invalidated.- Normally you would only use this function in widget implementations. You might also use it to schedule a redraw of a - Gtk.DrawingAreaor some portion thereof.- New in version 3.0. 
 - 
queue_resize()[source]¶
- This function is only for use in widget implementations. Flags a widget to have its size renegotiated; should be called when a widget for some reason has a new size request. For example, when you change the text in a - Gtk.Label,- Gtk.Labelqueues a resize to ensure there’s enough space for the new text.- Note that you cannot call - Gtk.Widget.queue_resize() on a widget from inside its implementation of the GtkWidgetClass::size_allocate virtual method. Calls to- Gtk.Widget.queue_resize() from inside GtkWidgetClass::size_allocate will be silently ignored.
 - 
queue_resize_no_redraw()[source]¶
- This function works like - Gtk.Widget.queue_resize(), except that the widget is not invalidated.- New in version 2.4. 
 - 
realize()[source]¶
- Creates the GDK (windowing system) resources associated with a widget. For example, self->window will be created when a widget is realized. Normally realization happens implicitly; if you show a widget and all its parent containers, then the widget will be realized and mapped automatically. - Realizing a widget requires all the widget’s parent widgets to be realized; calling - Gtk.Widget.realize() realizes the widget’s parents in addition to self itself. If a widget is not yet inside a toplevel window when you realize it, bad things will happen.- This function is primarily used in widget implementations, and isn’t very useful otherwise. Many times when you think you might need it, a better approach is to connect to a signal that will be called after the widget is realized automatically, such as - Gtk.Widget- ::draw. Or simply g_signal_connect () to the- Gtk.Widget- ::realizesignal.
 - 
region_intersect(region)[source]¶
- Parameters: - region ( - cairo.Region) – a- cairo.Region, in the same coordinate system as self->allocation. That is, relative to self->window for widgets which return- Falsefrom- Gtk.Widget.get_has_window(); relative to the parent window of self->window otherwise.- Returns: - A newly allocated region holding the intersection of self and region. - Return type: - cairo.Region- Computes the intersection of a self’s area and region, returning the intersection. The result may be empty, use cairo_region_is_empty() to check. - Deprecated since version 3.14: Use - Gtk.Widget.get_allocation() and cairo_region_intersect_rectangle() to get the same behavior.
 - 
register_window(window)[source]¶
- Parameters: - window ( - Gdk.Window) – a- Gdk.Window- Registers a - Gdk.Windowwith the widget and sets it up so that the widget receives events for it. Call- Gtk.Widget.unregister_window() when destroying the window.- Before 3.8 you needed to call - Gdk.Window.set_user_data() directly to set this up. This is now deprecated and you should use- Gtk.Widget.register_window() instead. Old code will keep working as is, although some new features like transparency might not work perfectly.- New in version 3.8. 
 - 
remove_accelerator(accel_group, accel_key, accel_mods)[source]¶
- Parameters: - accel_group (Gtk.AccelGroup) – accel group for this widget
- accel_key (int) – GDK keyval of the accelerator
- accel_mods (Gdk.ModifierType) – modifier key combination of the accelerator
 - Returns: - whether an accelerator was installed and could be removed - Return type: - Removes an accelerator from self, previously installed with - Gtk.Widget.add_accelerator().
- accel_group (
 - 
remove_mnemonic_label(label)[source]¶
- Parameters: - label ( - Gtk.Widget) – a- Gtk.Widgetthat was previously set as a mnemonic label for self with- Gtk.Widget.add_mnemonic_label().- Removes a widget from the list of mnemonic labels for this widget. (See - Gtk.Widget.list_mnemonic_labels()). The widget must have previously been added to the list with- Gtk.Widget.add_mnemonic_label().- New in version 2.4. 
 - 
remove_tick_callback(id)[source]¶
- Parameters: - id ( - int) – an id returned by- Gtk.Widget.add_tick_callback()- Removes a tick callback previously registered with - Gtk.Widget.add_tick_callback().- New in version 3.8. 
 - 
render_icon(stock_id, size, detail)[source]¶
- Parameters: - stock_id (str) – a stock ID
- size (int) – a stock size (Gtk.IconSize). A size of(GtkIconSize)-1means render at the size of the source and don’t scale (if there are multiple source sizes, GTK+ picks one of the available sizes).
- detail (strorNone) – render detail to pass to theme engine
 - Returns: - a new pixbuf, or - Noneif the stock ID wasn’t known- Return type: - A convenience function that uses the theme settings for self to look up stock_id and render it to a pixbuf. stock_id should be a stock icon ID such as - Gtk.STOCK_OPENor- Gtk.STOCK_OK. size should be a size such as- Gtk.IconSize.MENU. detail should be a string that identifies the widget or code doing the rendering, so that theme engines can special-case rendering for that widget or code.- The pixels in the returned - GdkPixbuf.Pixbufare shared with the rest of the application and should not be modified. The pixbuf should be freed after use with- GObject.Object.unref().- Deprecated since version 3.0: Use - Gtk.Widget.render_icon_pixbuf() instead.
- stock_id (
 - 
render_icon_pixbuf(stock_id, size)[source]¶
- Parameters: - stock_id (str) – a stock ID
- size (int) – a stock size (Gtk.IconSize). A size of(GtkIconSize)-1means render at the size of the source and don’t scale (if there are multiple source sizes, GTK+ picks one of the available sizes).
 - Returns: - a new pixbuf, or - Noneif the stock ID wasn’t known- Return type: - A convenience function that uses the theme engine and style settings for self to look up stock_id and render it to a pixbuf. stock_id should be a stock icon ID such as - Gtk.STOCK_OPENor- Gtk.STOCK_OK. size should be a size such as- Gtk.IconSize.MENU.- The pixels in the returned - GdkPixbuf.Pixbufare shared with the rest of the application and should not be modified. The pixbuf should be freed after use with- GObject.Object.unref().- New in version 3.0. - Deprecated since version 3.10: Use - Gtk.IconTheme.load_icon() instead.
- stock_id (
 - 
reparent(new_parent)[source]¶
- Parameters: - new_parent ( - Gtk.Widget) – a- Gtk.Containerto move the widget into- Moves a widget from one - Gtk.Containerto another, handling reference count issues to avoid destroying the widget.- Deprecated since version 3.14: Use - Gtk.Container.remove() and- Gtk.Container.add().
 - 
reset_rc_styles()[source]¶
- Reset the styles of self and all descendents, so when they are looked up again, they get the correct values for the currently loaded RC file settings. - This function is not useful for applications. - Deprecated since version 3.0: Use - Gtk.StyleContextinstead, and- Gtk.Widget.reset_style()
 - 
reset_style()[source]¶
- Updates the style context of self and all descendants by updating its widget path. - Gtk.Containersmay want to use this on a child when reordering it in a way that a different style might apply to it. See also- Gtk.Container.get_path_for_child().- New in version 3.0. 
 - 
send_expose(event)[source]¶
- Parameters: - event ( - Gdk.Event) – a expose- Gdk.Event- Returns: - return from the event signal emission ( - Trueif the event was handled)- Return type: - int- Very rarely-used function. This function is used to emit an expose event on a widget. This function is not normally used directly. The only time it is used is when propagating an expose event to a windowless child widget ( - Gtk.Widget.get_has_window() is- False), and that is normally done using- Gtk.Container.propagate_draw().- If you want to force an area of a window to be redrawn, use - Gdk.Window.invalidate_rect() or- Gdk.Window.invalidate_region(). To cause the redraw to be done immediately, follow that call with a call to- Gdk.Window.process_updates().- Deprecated since version 3.22: Application and widget code should not handle expose events directly; invalidation should use the - Gtk.WidgetAPI, and drawing should only happen inside- Gtk.Widget- ::drawimplementations
 - 
send_focus_change(event)[source]¶
- Parameters: - event ( - Gdk.Event) – a- Gdk.Eventof type- Gdk.EventType.FOCUS_CHANGE- Returns: - the return value from the event signal emission: - Trueif the event was handled, and- Falseotherwise- Return type: - bool- Sends the focus change event to self - This function is not meant to be used by applications. The only time it should be used is when it is necessary for a - Gtk.Widgetto assign focus to a widget that is semantically owned by the first widget even though it’s not a direct child - for instance, a search entry in a floating window similar to the quick search in- Gtk.TreeView.- An example of its usage is: - GdkEvent *fevent = gdk_event_new (GDK_FOCUS_CHANGE); fevent->focus_change.type = GDK_FOCUS_CHANGE; fevent->focus_change.in = TRUE; fevent->focus_change.window = _gtk_widget_get_window (widget); if (fevent->focus_change.window != NULL) g_object_ref (fevent->focus_change.window); gtk_widget_send_focus_change (widget, fevent); gdk_event_free (event); - New in version 2.20. 
 - 
set_accel_path(accel_path, accel_group)[source]¶
- Parameters: - accel_path (strorNone) – path used to look up the accelerator
- accel_group (Gtk.AccelGrouporNone) – aGtk.AccelGroup.
 - Given an accelerator group, accel_group, and an accelerator path, accel_path, sets up an accelerator in accel_group so whenever the key binding that is defined for accel_path is pressed, self will be activated. This removes any accelerators (for any accelerator group) installed by previous calls to - Gtk.Widget.set_accel_path(). Associating accelerators with paths allows them to be modified by the user and the modifications to be saved for future use. (See- Gtk.AccelMap.save().)- This function is a low level function that would most likely be used by a menu creation system like - Gtk.UIManager. If you use- Gtk.UIManager, setting up accelerator paths will be done automatically.- Even when you you aren’t using - Gtk.UIManager, if you only want to set up accelerators on menu items- Gtk.MenuItem.set_accel_path() provides a somewhat more convenient interface.- Note that accel_path string will be stored in a #GQuark. Therefore, if you pass a static string, you can save some memory by interning it first with - GLib.intern_static_string().
- accel_path (
 - 
set_allocation(allocation)[source]¶
- Parameters: - allocation ( - Gdk.Rectangle) – a pointer to a #GtkAllocation to copy from- Sets the widget’s allocation. This should not be used directly, but from within a widget’s size_allocate method. - The allocation set should be the “adjusted” or actual allocation. If you’re implementing a - Gtk.Container, you want to use- Gtk.Widget.size_allocate() instead of- Gtk.Widget.set_allocation(). The GtkWidgetClass::adjust_size_allocation virtual method adjusts the allocation inside- Gtk.Widget.size_allocate() to create an adjusted allocation.- New in version 2.18. 
 - 
set_app_paintable(app_paintable)[source]¶
- Parameters: - app_paintable ( - bool) –- Trueif the application will paint on the widget- Sets whether the application intends to draw on the widget in an - Gtk.Widget- ::drawhandler.- This is a hint to the widget and does not affect the behavior of the GTK+ core; many widgets ignore this flag entirely. For widgets that do pay attention to the flag, such as - Gtk.EventBoxand- Gtk.Window, the effect is to suppress default themed drawing of the widget’s background. (Children of the widget will still be drawn.) The application is then entirely responsible for drawing the widget background.- Note that the background is still drawn when the widget is mapped. 
 - 
set_can_default(can_default)[source]¶
- Parameters: - can_default ( - bool) – whether or not self can be a default widget.- Specifies whether self can be a default widget. See - Gtk.Widget.grab_default() for details about the meaning of “default”.- New in version 2.18. 
 - 
set_can_focus(can_focus)[source]¶
- Parameters: - can_focus ( - bool) – whether or not self can own the input focus.- Specifies whether self can own the input focus. See - Gtk.Widget.grab_focus() for actually setting the input focus on a widget.- New in version 2.18. 
 - 
set_child_visible(is_visible)[source]¶
- Parameters: - is_visible ( - bool) – if- True, self should be mapped along with its parent.- Sets whether self should be mapped along with its when its parent is mapped and self has been shown with - Gtk.Widget.show().- The child visibility can be set for widget before it is added to a container with - Gtk.Widget.set_parent(), to avoid mapping children unnecessary before immediately unmapping them. However it will be reset to its default state of- Truewhen the widget is removed from a container.- Note that changing the child visibility of a widget does not queue a resize on the widget. Most of the time, the size of a widget is computed from all visible children, whether or not they are mapped. If this is not the case, the container can queue a resize itself. - This function is only useful for container implementations and never should be called by an application. 
 - 
set_clip(clip)[source]¶
- Parameters: - clip ( - Gdk.Rectangle) – a pointer to a #GtkAllocation to copy from- Sets the widget’s clip. This must not be used directly, but from within a widget’s size_allocate method. It must be called after - Gtk.Widget.set_allocation() (or after chaining up to the parent class), because that function resets the clip.- The clip set should be the area that self draws on. If self is a - Gtk.Container, the area must contain all children’s clips.- If this function is not called by self during a - ::size-allocatehandler, the clip will be set to self’s allocation.- New in version 3.14. 
 - 
set_composite_name(name)[source]¶
- Parameters: - name ( - str) – the name to set- Sets a widgets composite name. The widget must be a composite child of its parent; see - Gtk.Widget.push_composite_child().- Deprecated since version 3.10: Use - Gtk.WidgetClass.set_template(), or don’t use this API at all.
 - 
set_device_enabled(device, enabled)[source]¶
- Parameters: - device (Gdk.Device) – aGdk.Device
- enabled (bool) – whether to enable the device
 - Enables or disables a - Gdk.Deviceto interact with self and all its children.- It does so by descending through the - Gdk.Windowhierarchy and enabling the same mask that is has for core events (i.e. the one that- Gdk.Window.get_events() returns).- New in version 3.0. 
- device (
 - 
set_device_events(device, events)[source]¶
- Parameters: - device (Gdk.Device) – aGdk.Device
- events (Gdk.EventMask) – event mask
 - Sets the device event mask (see - Gdk.EventMask) for a widget. The event mask determines which events a widget will receive from device. Keep in mind that different widgets have different default event masks, and by changing the event mask you may disrupt a widget’s functionality, so be careful. This function must be called while a widget is unrealized. Consider- Gtk.Widget.add_device_events() for widgets that are already realized, or if you want to preserve the existing event mask. This function can’t be used with windowless widgets (which return- Falsefrom- Gtk.Widget.get_has_window()); to get events on those widgets, place them inside a- Gtk.EventBoxand receive events on the event box.- New in version 3.0. 
- device (
 - 
set_direction(dir)[source]¶
- Parameters: - dir ( - Gtk.TextDirection) – the new direction- Sets the reading direction on a particular widget. This direction controls the primary direction for widgets containing text, and also the direction in which the children of a container are packed. The ability to set the direction is present in order so that correct localization into languages with right-to-left reading directions can be done. Generally, applications will let the default reading direction present, except for containers where the containers are arranged in an order that is explicitly visual rather than logical (such as buttons for text justification). - If the direction is set to - Gtk.TextDirection.NONE, then the value set by- Gtk.Widget.set_default_direction() will be used.
 - 
set_double_buffered(double_buffered)[source]¶
- Parameters: - double_buffered ( - bool) –- Trueto double-buffer a widget- Widgets are double buffered by default; you can use this function to turn off the buffering. “Double buffered” simply means that - Gdk.Window.begin_draw_frame() and- Gdk.Window.end_draw_frame() are called automatically around expose events sent to the widget.- Gdk.Window.begin_draw_frame() diverts all drawing to a widget’s window to an offscreen buffer, and- Gdk.Window.end_draw_frame() draws the buffer to the screen. The result is that users see the window update in one smooth step, and don’t see individual graphics primitives being rendered.- In very simple terms, double buffered widgets don’t flicker, so you would only use this function to turn off double buffering if you had special needs and really knew what you were doing. - Note: if you turn off double-buffering, you have to handle expose events, since even the clearing to the background color or pixmap will not happen automatically (as it is done in - Gdk.Window.begin_draw_frame()).- In 3.10 GTK and GDK have been restructured for translucent drawing. Since then expose events for double-buffered widgets are culled into a single event to the toplevel GDK window. If you now unset double buffering, you will cause a separate rendering pass for every widget. This will likely cause rendering problems - in particular related to stacking - and usually increases rendering times significantly. - Deprecated since version 3.14: This function does not work under non-X11 backends or with non-native windows. It should not be used in newly written code. 
 - 
set_events(events)[source]¶
- Parameters: - events ( - int) – event mask- Sets the event mask (see - Gdk.EventMask) for a widget. The event mask determines which events a widget will receive. Keep in mind that different widgets have different default event masks, and by changing the event mask you may disrupt a widget’s functionality, so be careful. This function must be called while a widget is unrealized. Consider- Gtk.Widget.add_events() for widgets that are already realized, or if you want to preserve the existing event mask. This function can’t be used with widgets that have no window. (See- Gtk.Widget.get_has_window()). To get events on those widgets, place them inside a- Gtk.EventBoxand receive events on the event box.
 - 
set_focus_on_click(focus_on_click)[source]¶
- Parameters: - focus_on_click ( - bool) – whether the widget should grab focus when clicked with the mouse- Sets whether the widget should grab focus when it is clicked with the mouse. Making mouse clicks not grab focus is useful in places like toolbars where you don’t want the keyboard focus removed from the main area of the application. - New in version 3.20. 
 - 
set_font_map(font_map)[source]¶
- Parameters: - font_map ( - Pango.FontMapor- None) – a- Pango.FontMap, or- Noneto unset any previously set font map- Sets the font map to use for Pango rendering. When not set, the widget will inherit the font map from its parent. - New in version 3.18. 
 - 
set_font_options(options)[source]¶
- Parameters: - options ( - cairo.FontOptionsor- None) – a- cairo.FontOptions, or- Noneto unset any previously set default font options.- Sets the - cairo.FontOptionsused for Pango rendering in this widget. When not set, the default font options for the- Gdk.Screenwill be used.- New in version 3.18. 
 - 
set_halign(align)[source]¶
- Parameters: - align ( - Gtk.Align) – the horizontal alignment- Sets the horizontal alignment of self. See the - Gtk.Widget- :halignproperty.
 - 
set_has_tooltip(has_tooltip)[source]¶
- Parameters: - has_tooltip ( - bool) – whether or not self has a tooltip.- Sets the has-tooltip property on self to has_tooltip. See - Gtk.Widget- :has-tooltipfor more information.- New in version 2.12. 
 - 
set_has_window(has_window)[source]¶
- Parameters: - has_window ( - bool) – whether or not self has a window.- Specifies whether self has a - Gdk.Windowof its own. Note that all realized widgets have a non-- None“window” pointer (- Gtk.Widget.get_window() never returns a- Nonewindow when a widget is realized), but for many of them it’s actually the- Gdk.Windowof one of its parent widgets. Widgets that do not create a %window for themselves in- Gtk.Widget- ::realizemust announce this by calling this function with has_window =- False.- This function should only be called by widget implementations, and they should call it in their init() function. - New in version 2.18. 
 - 
set_hexpand(expand)[source]¶
- Parameters: - expand ( - bool) – whether to expand- Sets whether the widget would like any available extra horizontal space. When a user resizes a - Gtk.Window, widgets with expand=:obj:True generally receive the extra space. For example, a list or scrollable area or document in your window would often be set to expand.- Call this function to set the expand flag if you would like your widget to become larger horizontally when the window has extra room. - By default, widgets automatically expand if any of their children want to expand. (To see if a widget will automatically expand given its current children and state, call - Gtk.Widget.compute_expand(). A container can decide how the expandability of children affects the expansion of the container by overriding the compute_expand virtual method on- Gtk.Widget.).- Setting hexpand explicitly with this function will override the automatic expand behavior. - This function forces the widget to expand or not to expand, regardless of children. The override occurs because - Gtk.Widget.set_hexpand() sets the hexpand-set property (see- Gtk.Widget.set_hexpand_set()) which causes the widget’s hexpand value to be used, rather than looking at children and widget state.
 - 
set_hexpand_set(set)[source]¶
- Parameters: - set ( - bool) – value for hexpand-set property- Sets whether the hexpand flag (see - Gtk.Widget.get_hexpand()) will be used.- The hexpand-set property will be set automatically when you call - Gtk.Widget.set_hexpand() to set hexpand, so the most likely reason to use this function would be to unset an explicit expand flag.- If hexpand is set, then it overrides any computed expand value based on child widgets. If hexpand is not set, then the expand value depends on whether any children of the widget would like to expand. - There are few reasons to use this function, but it’s here for completeness and consistency. 
 - 
set_mapped(mapped)[source]¶
- Parameters: - mapped ( - bool) –- Trueto mark the widget as mapped- Marks the widget as being mapped. - This function should only ever be called in a derived widget’s “map” or “unmap” implementation. - New in version 2.20. 
 - 
set_margin_bottom(margin)[source]¶
- Parameters: - margin ( - int) – the bottom margin- Sets the bottom margin of self. See the - Gtk.Widget- :margin-bottomproperty.- New in version 3.0. 
 - 
set_margin_end(margin)[source]¶
- Parameters: - margin ( - int) – the end margin- Sets the end margin of self. See the - Gtk.Widget- :margin-endproperty.- New in version 3.12. 
 - 
set_margin_left(margin)[source]¶
- Parameters: - margin ( - int) – the left margin- Sets the left margin of self. See the - Gtk.Widget- :margin-leftproperty.- New in version 3.0. - Deprecated since version 3.12: Use - Gtk.Widget.set_margin_start() instead.
 - 
set_margin_right(margin)[source]¶
- Parameters: - margin ( - int) – the right margin- Sets the right margin of self. See the - Gtk.Widget- :margin-rightproperty.- New in version 3.0. - Deprecated since version 3.12: Use - Gtk.Widget.set_margin_end() instead.
 - 
set_margin_start(margin)[source]¶
- Parameters: - margin ( - int) – the start margin- Sets the start margin of self. See the - Gtk.Widget- :margin-startproperty.- New in version 3.12. 
 - 
set_margin_top(margin)[source]¶
- Parameters: - margin ( - int) – the top margin- Sets the top margin of self. See the - Gtk.Widget- :margin-topproperty.- New in version 3.0. 
 - 
set_name(name)[source]¶
- Parameters: - name ( - str) – name for the widget- Widgets can be named, which allows you to refer to them from a CSS file. You can apply a style to widgets with a particular name in the CSS file. See the documentation for the CSS syntax (on the same page as the docs for - Gtk.StyleContext).- Note that the CSS syntax has certain special characters to delimit and represent elements in a selector (period, #, >, *…), so using these will make your widget impossible to match by name. Any combination of alphanumeric symbols, dashes and underscores will suffice. 
 - 
set_no_show_all(no_show_all)[source]¶
- Parameters: - no_show_all ( - bool) – the new value for the “no-show-all” property- Sets the - Gtk.Widget- :no-show-allproperty, which determines whether calls to- Gtk.Widget.show_all() will affect this widget.- This is mostly for use in constructing widget hierarchies with externally controlled visibility, see - Gtk.UIManager.- New in version 2.4. 
 - 
set_opacity(opacity)[source]¶
- Parameters: - opacity ( - float) – desired opacity, between 0 and 1- Request the self to be rendered partially transparent, with opacity 0 being fully transparent and 1 fully opaque. (Opacity values are clamped to the [0,1] range.). This works on both toplevel widget, and child widgets, although there are some limitations: - For toplevel widgets this depends on the capabilities of the windowing system. On X11 this has any effect only on X screens with a compositing manager running. See - Gtk.Widget.is_composited(). On Windows it should work always, although setting a window’s opacity after the window has been shown causes it to flicker once on Windows.- For child widgets it doesn’t work if any affected widget has a native window, or disables double buffering. - New in version 3.8. 
 - 
set_parent(parent)[source]¶
- Parameters: - parent ( - Gtk.Widget) – parent container- This function is useful only when implementing subclasses of - Gtk.Container. Sets the container as the parent of self, and takes care of some details such as updating the state and style of the child to reflect its new location. The opposite function is- Gtk.Widget.unparent().
 - 
set_parent_window(parent_window)[source]¶
- Parameters: - parent_window ( - Gdk.Window) – the new parent window.- Sets a non default parent window for self. - For - Gtk.Windowclasses, setting a parent_window effects whether the window is a toplevel window or can be embedded into other widgets.- For - Gtk.Windowclasses, this needs to be called before the window is realized.
 - 
set_realized(realized)[source]¶
- Parameters: - realized ( - bool) –- Trueto mark the widget as realized- Marks the widget as being realized. This function must only be called after all - Gdk.Windowsfor the self have been created and registered.- This function should only ever be called in a derived widget’s “realize” or “unrealize” implementation. - New in version 2.20. 
 - 
set_receives_default(receives_default)[source]¶
- Parameters: - receives_default ( - bool) – whether or not self can be a default widget.- Specifies whether self will be treated as the default widget within its toplevel when it has the focus, even if another widget is the default. - See - Gtk.Widget.grab_default() for details about the meaning of “default”.- New in version 2.18. 
 - 
set_redraw_on_allocate(redraw_on_allocate)[source]¶
- Parameters: - redraw_on_allocate ( - bool) – if- True, the entire widget will be redrawn when it is allocated to a new size. Otherwise, only the new portion of the widget will be redrawn.- Sets whether the entire widget is queued for drawing when its size allocation changes. By default, this setting is - Trueand the entire widget is redrawn on every size change. If your widget leaves the upper left unchanged when made bigger, turning this setting off will improve performance.- Note that for widgets where - Gtk.Widget.get_has_window() is- Falsesetting this flag to- Falseturns off all allocation on resizing: the widget will not even redraw if its position changes; this is to allow containers that don’t draw anything to avoid excess invalidations. If you set this flag on a widget with no window that does draw on self->window, you are responsible for invalidating both the old and new allocation of the widget when the widget is moved and responsible for invalidating regions newly when the widget increases size.
 - 
set_sensitive(sensitive)[source]¶
- Parameters: - sensitive ( - bool) –- Trueto make the widget sensitive- Sets the sensitivity of a widget. A widget is sensitive if the user can interact with it. Insensitive widgets are “grayed out” and the user can’t interact with them. Insensitive widgets are known as “inactive”, “disabled”, or “ghosted” in some other toolkits. 
 - 
set_size_request(width, height)[source]¶
- Parameters: - Sets the minimum size of a widget; that is, the widget’s size request will be at least width by height. You can use this function to force a widget to be larger than it normally would be. - In most cases, - Gtk.Window.set_default_size() is a better choice for toplevel windows than this function; setting the default size will still allow users to shrink the window. Setting the size request will force them to leave the window at least as large as the size request. When dealing with window sizes,- Gtk.Window.set_geometry_hints() can be a useful function as well.- Note the inherent danger of setting any fixed size - themes, translations into other languages, different fonts, and user action can all change the appropriate size for a given widget. So, it’s basically impossible to hardcode a size that will always be correct. - The size request of a widget is the smallest size a widget can accept while still functioning well and drawing itself correctly. However in some strange cases a widget may be allocated less than its requested size, and in many cases a widget may be allocated more space than it requested. - If the size request in a given direction is -1 (unset), then the “natural” size request of the widget will be used instead. - The size request set here does not include any margin from the - Gtk.Widgetproperties margin-left, margin-right, margin-top, and margin-bottom, but it does include pretty much all other padding or border properties set by any subclass of- Gtk.Widget.
 - 
set_state(state)[source]¶
- Parameters: - state ( - Gtk.StateType) – new state for self- This function is for use in widget implementations. Sets the state of a widget (insensitive, prelighted, etc.) Usually you should set the state using wrapper functions such as - Gtk.Widget.set_sensitive().- Deprecated since version 3.0: Use - Gtk.Widget.set_state_flags() instead.
 - 
set_state_flags(flags, clear)[source]¶
- Parameters: - flags (Gtk.StateFlags) – State flags to turn on
- clear (bool) – Whether to clear state before turning on flags
 - This function is for use in widget implementations. Turns on flag values in the current widget state (insensitive, prelighted, etc.). - This function accepts the values - Gtk.StateFlags.DIR_LTRand- Gtk.StateFlags.DIR_RTLbut ignores them. If you want to set the widget’s direction, use- Gtk.Widget.set_direction().- It is worth mentioning that any other state than - Gtk.StateFlags.INSENSITIVE, will be propagated down to all non-internal children if self is a- Gtk.Container, while- Gtk.StateFlags.INSENSITIVEitself will be propagated down to all- Gtk.Containerchildren by different means than turning on the state flag down the hierarchy, both- Gtk.Widget.get_state_flags() and- Gtk.Widget.is_sensitive() will make use of these.- New in version 3.0. 
- flags (
 - 
set_style(style)[source]¶
- Parameters: - style ( - Gtk.Styleor- None) – a- Gtk.Style, or- Noneto remove the effect of a previous call to- Gtk.Widget.set_style() and go back to the default style- Used to set the - Gtk.Stylefor a widget (self->style). Since GTK 3, this function does nothing, the passed in style is ignored.- Deprecated since version 3.0: Use - Gtk.StyleContextinstead
 - 
set_support_multidevice(support_multidevice)[source]¶
- Parameters: - support_multidevice ( - bool) –- Trueto support input from multiple devices.- Enables or disables multiple pointer awareness. If this setting is - True, self will start receiving multiple, per device enter/leave events. Note that if custom- Gdk.Windowsare created in- Gtk.Widget- ::realize,- Gdk.Window.set_support_multidevice() will have to be called manually on them.- New in version 3.0. 
 - 
set_tooltip_markup(markup)[source]¶
- Parameters: - markup ( - stror- None) – the contents of the tooltip for self, or- None- Sets markup as the contents of the tooltip, which is marked up with the Pango text markup language. - This function will take care of setting - Gtk.Widget- :has-tooltipto- Trueand of the default handler for the- Gtk.Widget- ::query-tooltipsignal.- See also the - Gtk.Widget- :tooltip-markupproperty and- Gtk.Tooltip.set_markup().- New in version 2.12. 
 - 
set_tooltip_text(text)[source]¶
- Parameters: - text ( - stror- None) – the contents of the tooltip for self- Sets text as the contents of the tooltip. This function will take care of setting - Gtk.Widget- :has-tooltipto- Trueand of the default handler for the- Gtk.Widget- ::query-tooltipsignal.- See also the - Gtk.Widget- :tooltip-textproperty and- Gtk.Tooltip.set_text().- New in version 2.12. 
 - 
set_tooltip_window(custom_window)[source]¶
- Parameters: - custom_window ( - Gtk.Windowor- None) – a- Gtk.Window, or- None- Replaces the default window used for displaying tooltips with custom_window. GTK+ will take care of showing and hiding custom_window at the right moment, to behave likewise as the default tooltip window. If custom_window is - None, the default tooltip window will be used.- New in version 2.12. 
 - 
set_valign(align)[source]¶
- Parameters: - align ( - Gtk.Align) – the vertical alignment- Sets the vertical alignment of self. See the - Gtk.Widget- :valignproperty.
 - 
set_vexpand(expand)[source]¶
- Parameters: - expand ( - bool) – whether to expand- Sets whether the widget would like any available extra vertical space. - See - Gtk.Widget.set_hexpand() for more detail.
 - 
set_vexpand_set(set)[source]¶
- Parameters: - set ( - bool) – value for vexpand-set property- Sets whether the vexpand flag (see - Gtk.Widget.get_vexpand()) will be used.- See - Gtk.Widget.set_hexpand_set() for more detail.
 - 
set_visible(visible)[source]¶
- Parameters: - visible ( - bool) – whether the widget should be shown or not- Sets the visibility state of self. Note that setting this to - Truedoesn’t mean the widget is actually viewable, see- Gtk.Widget.get_visible().- This function simply calls - Gtk.Widget.show() or- Gtk.Widget.hide() but is nicer to use when the visibility of the widget depends on some condition.- New in version 2.18. 
 - 
set_visual(visual)[source]¶
- Parameters: - visual ( - Gdk.Visualor- None) – visual to be used or- Noneto unset a previous one- Sets the visual that should be used for by widget and its children for creating - Gdk.Windows. The visual must be on the same- Gdk.Screenas returned by- Gtk.Widget.get_screen(), so handling the- Gtk.Widget- ::screen-changedsignal is necessary.- Setting a new visual will not cause self to recreate its windows, so you should call this function before self is realized. 
 - 
set_window(window)[source]¶
- Parameters: - window ( - Gdk.Window) – a- Gdk.Window- Sets a widget’s window. This function should only be used in a widget’s - Gtk.Widget- ::realizeimplementation. The %window passed is usually either new window created with- Gdk.Window.new(), or the window of its parent widget as returned by- Gtk.Widget.get_parent_window().- Widgets must indicate whether they will create their own - Gdk.Windowby calling- Gtk.Widget.set_has_window(). This is usually done in the widget’s init() function.- Note that this function does not add any reference to window. - New in version 2.18. 
 - 
shape_combine_region(region)[source]¶
- Parameters: - region ( - cairo.Regionor- None) – shape to be added, or- Noneto remove an existing shape- Sets a shape for this widget’s GDK window. This allows for transparent windows etc., see - Gdk.Window.shape_combine_region() for more information.- New in version 3.0. 
 - 
show()[source]¶
- Flags a widget to be displayed. Any widget that isn’t shown will not appear on the screen. If you want to show all the widgets in a container, it’s easier to call - Gtk.Widget.show_all() on the container, instead of individually showing the widgets.- Remember that you have to show the containers containing a widget, in addition to the widget itself, before it will appear onscreen. - When a toplevel container is shown, it is immediately realized and mapped; other shown widgets are realized and mapped when their toplevel container is realized and mapped. 
 - 
show_all()[source]¶
- Recursively shows a widget, and any child widgets (if the widget is a container). 
 - 
show_now()[source]¶
- Shows a widget. If the widget is an unmapped toplevel widget (i.e. a - Gtk.Windowthat has not yet been shown), enter the main loop and wait for the window to actually be mapped. Be careful; because the main loop is running, anything can happen during this function.
 - 
size_allocate(allocation)[source]¶
- Parameters: - allocation ( - Gdk.Rectangle) – position and size to be allocated to self- This function is only used by - Gtk.Containersubclasses, to assign a size and position to their child widgets.- In this function, the allocation may be adjusted. It will be forced to a 1x1 minimum size, and the adjust_size_allocation virtual method on the child will be used to adjust the allocation. Standard adjustments include removing the widget’s margins, and applying the widget’s - Gtk.Widget- :halignand- Gtk.Widget- :valignproperties.- For baseline support in containers you need to use - Gtk.Widget.size_allocate_with_baseline() instead.
 - 
size_allocate_with_baseline(allocation, baseline)[source]¶
- Parameters: - allocation (Gdk.Rectangle) – position and size to be allocated to self
- baseline (int) – The baseline of the child, or -1
 - This function is only used by - Gtk.Containersubclasses, to assign a size, position and (optionally) baseline to their child widgets.- In this function, the allocation and baseline may be adjusted. It will be forced to a 1x1 minimum size, and the adjust_size_allocation virtual and adjust_baseline_allocation methods on the child will be used to adjust the allocation and baseline. Standard adjustments include removing the widget’s margins, and applying the widget’s - Gtk.Widget- :halignand- Gtk.Widget- :valignproperties.- If the child widget does not have a valign of - Gtk.Align.BASELINEthe baseline argument is ignored and -1 is used instead.- New in version 3.10. 
- allocation (
 - 
size_request()[source]¶
- Returns: - a - Gtk.Requisitionto be filled in- Return type: - requisition: - Gtk.Requisition- This function is typically used when implementing a - Gtk.Containersubclass. Obtains the preferred size of a widget. The container uses this information to arrange its child widgets and decide what size allocations to give them with- Gtk.Widget.size_allocate().- You can also call this function from an application, with some caveats. Most notably, getting a size request requires the widget to be associated with a screen, because font information may be needed. Multihead-aware applications should keep this in mind. - Also remember that the size request is not necessarily the size a widget will actually be allocated. - Deprecated since version 3.0: Use - Gtk.Widget.get_preferred_size() instead.
 - 
style_attach()[source]¶
- This function attaches the widget’s - Gtk.Styleto the widget’s- Gdk.Window. It is a replacement for- widget->style = gtk_style_attach (widget->style, widget->window);- and should only ever be called in a derived widget’s “realize” implementation which does not chain up to its parent class’ “realize” implementation, because one of the parent classes (finally - Gtk.Widget) would attach the style itself.- New in version 2.20. - Deprecated since version 3.0: This step is unnecessary with - Gtk.StyleContext.
 - 
style_get_property(property_name, value=None)[source]¶
- Parameters: - property_name (str) – the name of a style property
- value (GObject.ValueorNone) – EitherNoneor a correctly initializedGObject.Value
 - Returns: - The Python value of the style property - Gets the value of a style property of self. 
- property_name (
 - 
thaw_child_notify()[source]¶
- Reverts the effect of a previous call to - Gtk.Widget.freeze_child_notify(). This causes all queued- Gtk.Widget- ::child-notifysignals on self to be emitted.
 - 
translate_coordinates(dest_widget, src_x, src_y)[source]¶
- Parameters: - dest_widget (Gtk.Widget) – aGtk.Widget
- src_x (int) – X position relative to self
- src_y (int) – Y position relative to self
 - Returns: - Noneif either widget was not realized, or there was no common ancestor. Otherwise a- (dest_x, dest_y)tuple containing the X and Y position relative to dest_widget.- Return type: - Translate coordinates relative to self’s allocation to coordinates relative to dest_widget’s allocations. In order to perform this operation, both widgets must be realized, and must share a common toplevel. 
- dest_widget (
 - 
trigger_tooltip_query()[source]¶
- Triggers a tooltip query on the display where the toplevel of self is located. See - Gtk.Tooltip.trigger_tooltip_query() for more information.- New in version 2.12. 
 - 
unmap()[source]¶
- This function is only for use in widget implementations. Causes a widget to be unmapped if it’s currently mapped. 
 - 
unparent()[source]¶
- This function is only for use in widget implementations. Should be called by implementations of the remove method on - Gtk.Container, to dissociate a child from the container.
 - 
unrealize()[source]¶
- This function is only useful in widget implementations. Causes a widget to be unrealized (frees all GDK resources associated with the widget, such as self->window). 
 - 
unregister_window(window)[source]¶
- Parameters: - window ( - Gdk.Window) – a- Gdk.Window- Unregisters a - Gdk.Windowfrom the widget that was previously set up with- Gtk.Widget.register_window(). You need to call this when the window is no longer used by the widget, such as when you destroy it.- New in version 3.8. 
 - 
unset_state_flags(flags)[source]¶
- Parameters: - flags ( - Gtk.StateFlags) – State flags to turn off- This function is for use in widget implementations. Turns off flag values for the current widget state (insensitive, prelighted, etc.). See - Gtk.Widget.set_state_flags().- New in version 3.0. 
 - 
do_adjust_baseline_request(minimum_baseline, natural_baseline) virtual¶
- Parameters: 
 - 
do_adjust_size_allocation(orientation, minimum_size, natural_size, allocated_pos, allocated_size) virtual¶
- Parameters: - orientation (Gtk.Orientation) –
- minimum_size (int) –
- natural_size (int) –
- allocated_pos (int) –
- allocated_size (int) –
 
- orientation (
 - 
do_adjust_size_request(orientation, minimum_size, natural_size) virtual¶
- Parameters: - orientation (Gtk.Orientation) –
- minimum_size (int) –
- natural_size (int) –
 
- orientation (
 - Parameters: - event ( - Gdk.EventButton) –- Return type: - bool
 - Parameters: - event ( - Gdk.EventButton) –- Return type: - bool
 - 
do_can_activate_accel(signal_id) virtual¶
- Parameters: - signal_id ( - int) – the ID of a signal installed on widget- Returns: - Trueif the accelerator can be activated.- Return type: - bool- Determines whether an accelerator that activates the signal identified by signal_id can currently be activated. This is done by emitting the - Gtk.Widget- ::can-activate-accelsignal on widget; if the signal isn’t overridden by a handler or in a derived widget, then the default check is that the widget must be sensitive, and the widget and all its ancestors mapped.- New in version 2.4. 
 - 
do_child_notify(child_property) virtual¶
- Parameters: - child_property ( - GObject.ParamSpec) – the name of a child property installed on the class of widget’s parent- Emits a - Gtk.Widget- ::child-notifysignal for the ‘child property [child-properties]’ child_property on widget.- This is the analogue of - GObject.Object.notify() for child properties.- Also see - Gtk.Container.child_notify().
 - 
do_composited_changed() virtual¶
 - 
do_configure_event(event) virtual¶
- Parameters: - event ( - Gdk.EventConfigure) –- Return type: - bool
 - 
do_damage_event(event) virtual¶
- Parameters: - event ( - Gdk.EventExpose) –- Return type: - bool
 - 
do_delete_event(event) virtual¶
- Parameters: - event ( - Gdk.EventAny) –- Return type: - bool
 - 
do_destroy() virtual¶
- Destroys a widget. - When a widget is destroyed all references it holds on other objects will be released: - if the widget is inside a container, it will be removed from its parent
- if the widget is a container, all its children will be destroyed, recursively
- if the widget is a top level, it will be removed from the list of top level widgets that GTK+ maintains internally
 - It’s expected that all references held on the widget will also be released; you should connect to the - Gtk.Widget- ::destroysignal if you hold a reference to widget and you wish to remove it when this function is called. It is not necessary to do so if you are implementing a- Gtk.Container, as you’ll be able to use the- Gtk.Container.do_remove() virtual function for that.- It’s important to notice that - Gtk.Widget.destroy() will only cause the widget to be finalized if no additional references, acquired using- GObject.Object.ref(), are held on it. In case additional references are in place, the widget will be in an “inert” state after calling this function; widget will still point to valid memory, allowing you to release the references you hold, but you may not query the widget’s own state.- You should typically call this function on top level widgets, and rarely on child widgets. - See also: - Gtk.Container.remove()
 - 
do_destroy_event(event) virtual¶
- Parameters: - event ( - Gdk.EventAny) –- Return type: - bool
 - 
do_direction_changed(previous_direction) virtual¶
- Parameters: - previous_direction ( - Gtk.TextDirection) –
 - 
do_dispatch_child_properties_changed(n_pspecs, pspecs) virtual¶
- Parameters: - n_pspecs (int) –
- pspecs (GObject.ParamSpec) –
 
- n_pspecs (
 - 
do_drag_begin(context) virtual¶
- Parameters: - context ( - Gdk.DragContext) –
 - 
do_drag_data_delete(context) virtual¶
- Parameters: - context ( - Gdk.DragContext) –
 - 
do_drag_data_get(context, selection_data, info, time_) virtual¶
- Parameters: - context (Gdk.DragContext) –
- selection_data (Gtk.SelectionData) –
- info (int) –
- time (int) –
 
- context (
 - 
do_drag_data_received(context, x, y, selection_data, info, time_) virtual¶
- Parameters: - context (Gdk.DragContext) –
- x (int) –
- y (int) –
- selection_data (Gtk.SelectionData) –
- info (int) –
- time (int) –
 
- context (
 - 
do_drag_drop(context, x, y, time_) virtual¶
- Parameters: - context (Gdk.DragContext) –
- x (int) –
- y (int) –
- time (int) –
 - Return type: 
- context (
 - 
do_drag_end(context) virtual¶
- Parameters: - context ( - Gdk.DragContext) –
 - 
do_drag_failed(context, result) virtual¶
- Parameters: - context (Gdk.DragContext) –
- result (Gtk.DragResult) –
 - Return type: 
- context (
 - 
do_drag_leave(context, time_) virtual¶
- Parameters: - context (Gdk.DragContext) –
- time (int) –
 
- context (
 - 
do_drag_motion(context, x, y, time_) virtual¶
- Parameters: - context (Gdk.DragContext) –
- x (int) –
- y (int) –
- time (int) –
 - Return type: 
- context (
 - 
do_draw(cr) virtual¶
- Parameters: - cr ( - cairo.Context) –- Return type: - bool
 - 
do_enter_notify_event(event) virtual¶
- Parameters: - event ( - Gdk.EventCrossing) –- Return type: - bool
 - 
do_event(event) virtual¶
- Parameters: - event ( - Gdk.Event) – a- Gdk.Event- Returns: - return from the event signal emission ( - Trueif the event was handled)- Return type: - bool- Rarely-used function. This function is used to emit the event signals on a widget (those signals should never be emitted without using this function to do so). If you want to synthesize an event though, don’t use this function; instead, use - Gtk.main_do_event() so the event will behave as if it were in the event queue. Don’t synthesize expose events; instead, use- Gdk.Window.invalidate_rect() to invalidate a region of the window.
 - 
do_focus(direction) virtual¶
- Parameters: - direction ( - Gtk.DirectionType) –- Return type: - bool
 - 
do_focus_in_event(event) virtual¶
- Parameters: - event ( - Gdk.EventFocus) –- Return type: - bool
 - 
do_focus_out_event(event) virtual¶
- Parameters: - event ( - Gdk.EventFocus) –- Return type: - bool
 - 
do_get_accessible() virtual¶
- Returns: - the - Atk.Objectassociated with widget- Return type: - Atk.Object- Returns the accessible object that describes the widget to an assistive technology. - If accessibility support is not available, this - Atk.Objectinstance may be a no-op. Likewise, if no class-specific- Atk.Objectimplementation is available for the widget instance in question, it will inherit an- Atk.Objectimplementation from the first ancestor class for which such an implementation is defined.- The documentation of the ATK library contains more information about accessible objects and their uses. 
 - 
do_get_preferred_height() virtual¶
- Returns: - minimum_height: - location to store the minimum height, or - None- natural_height: - location to store the natural height, or - None- Return type: - (minimum_height: - int, natural_height:- int)- Retrieves a widget’s initial minimum and natural height. - This call is specific to width-for-height requests. - The returned request will be modified by the GtkWidgetClass::adjust_size_request virtual method and by any - Gtk.SizeGroupsthat have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.- New in version 3.0. 
 - 
do_get_preferred_height_and_baseline_for_width(width) virtual¶
- Parameters: - width ( - int) – the width which is available for allocation, or -1 if none- Returns: - minimum_height: - location for storing the minimum height, or - None- natural_height: - location for storing the natural height, or - None- minimum_baseline: - location for storing the baseline for the minimum height, or - None- natural_baseline: - location for storing the baseline for the natural height, or - None- Return type: - (minimum_height: - int, natural_height:- int, minimum_baseline:- int, natural_baseline:- int)- Retrieves a widget’s minimum and natural height and the corresponding baselines if it would be given the specified width, or the default height if width is -1. The baselines may be -1 which means that no baseline is requested for this widget. - The returned request will be modified by the GtkWidgetClass::adjust_size_request and GtkWidgetClass::adjust_baseline_request virtual methods and by any - Gtk.SizeGroupsthat have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.- New in version 3.10. 
 - 
do_get_preferred_height_for_width(width) virtual¶
- Parameters: - width ( - int) – the width which is available for allocation- Returns: - minimum_height: - location for storing the minimum height, or - None- natural_height: - location for storing the natural height, or - None- Return type: - (minimum_height: - int, natural_height:- int)- Retrieves a widget’s minimum and natural height if it would be given the specified width. - The returned request will be modified by the GtkWidgetClass::adjust_size_request virtual method and by any - Gtk.SizeGroupsthat have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.- New in version 3.0. 
 - 
do_get_preferred_width() virtual¶
- Returns: - minimum_width: - location to store the minimum width, or - None- natural_width: - location to store the natural width, or - None- Return type: - (minimum_width: - int, natural_width:- int)- Retrieves a widget’s initial minimum and natural width. - This call is specific to height-for-width requests. - The returned request will be modified by the GtkWidgetClass::adjust_size_request virtual method and by any - Gtk.SizeGroupsthat have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.- New in version 3.0. 
 - 
do_get_preferred_width_for_height(height) virtual¶
- Parameters: - height ( - int) – the height which is available for allocation- Returns: - minimum_width: - location for storing the minimum width, or - None- natural_width: - location for storing the natural width, or - None- Return type: - (minimum_width: - int, natural_width:- int)- Retrieves a widget’s minimum and natural width if it would be given the specified height. - The returned request will be modified by the GtkWidgetClass::adjust_size_request virtual method and by any - Gtk.SizeGroupsthat have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.- New in version 3.0. 
 - 
do_get_request_mode() virtual¶
- Returns: - The - Gtk.SizeRequestModepreferred by widget.- Return type: - Gtk.SizeRequestMode- Gets whether the widget prefers a height-for-width layout or a width-for-height layout. - Gtk.Binwidgets generally propagate the preference of their child, container widgets need to request something either in context of their children or in context of their allocation capabilities.- New in version 3.0. 
 - 
do_grab_broken_event(event) virtual¶
- Parameters: - event ( - Gdk.EventGrabBroken) –- Return type: - bool
 - 
do_grab_focus() virtual¶
- Causes widget to have the keyboard focus for the - Gtk.Windowit’s inside. widget must be a focusable widget, such as a- Gtk.Entry; something like- Gtk.Framewon’t work.- More precisely, it must have the %GTK_CAN_FOCUS flag set. Use - Gtk.Widget.set_can_focus() to modify that flag.- The widget also needs to be realized and mapped. This is indicated by the related signals. Grabbing the focus immediately after creating the widget will likely fail and cause critical warnings. 
 - 
do_hide() virtual¶
- Reverses the effects of - Gtk.Widget.show(), causing the widget to be hidden (invisible to the user).
 - 
do_hierarchy_changed(previous_toplevel) virtual¶
- Parameters: - previous_toplevel ( - Gtk.Widget) –
 - 
do_key_press_event(event) virtual¶
- Parameters: - event ( - Gdk.EventKey) –- Return type: - bool
 - 
do_key_release_event(event) virtual¶
- Parameters: - event ( - Gdk.EventKey) –- Return type: - bool
 - Parameters: - direction ( - Gtk.DirectionType) – direction of focus movement- Returns: - Trueif stopping keyboard navigation is fine,- Falseif the emitting widget should try to handle the keyboard navigation attempt in its parent container(s).- Return type: - bool- This function should be called whenever keyboard navigation within a single widget hits a boundary. The function emits the - Gtk.Widget- ::keynav-failedsignal on the widget and its return value should be interpreted in a way similar to the return value of- Gtk.Widget.child_focus():- When - Trueis returned, stay in the widget, the failed keyboard navigation is OK and/or there is nowhere we can/should move the focus to.- When - Falseis returned, the caller should continue with keyboard navigation outside the widget, e.g. by calling- Gtk.Widget.child_focus() on the widget’s toplevel.- The default - ::keynav-failedhandler returns- Falsefor- Gtk.DirectionType.TAB_FORWARDand- Gtk.DirectionType.TAB_BACKWARD. For the other values of- Gtk.DirectionTypeit returns- True.- Whenever the default handler returns - True, it also calls- Gtk.Widget.error_bell() to notify the user of the failed keyboard navigation.- A use case for providing an own implementation of - ::keynav-failed(either by connecting to it or by overriding it) would be a row of- Gtk.Entrywidgets where the user should be able to navigate the entire row with the cursor keys, as e.g. known from user interfaces that require entering license keys.- New in version 2.12. 
 - 
do_leave_notify_event(event) virtual¶
- Parameters: - event ( - Gdk.EventCrossing) –- Return type: - bool
 - 
do_map() virtual¶
- This function is only for use in widget implementations. Causes a widget to be mapped if it isn’t already. 
 - 
do_map_event(event) virtual¶
- Parameters: - event ( - Gdk.EventAny) –- Return type: - bool
 - 
do_mnemonic_activate(group_cycling) virtual¶
- Parameters: - group_cycling ( - bool) –- Trueif there are other widgets with the same mnemonic- Returns: - Trueif the signal has been handled- Return type: - bool- Emits the - Gtk.Widget- ::mnemonic-activatesignal.
 - 
do_motion_notify_event(event) virtual¶
- Parameters: - event ( - Gdk.EventMotion) –- Return type: - bool
 - 
do_move_focus(direction) virtual¶
- Parameters: - direction ( - Gtk.DirectionType) –
 - 
do_parent_set(previous_parent) virtual¶
- Parameters: - previous_parent ( - Gtk.Widget) –
 - Return type: - bool
 - 
do_property_notify_event(event) virtual¶
- Parameters: - event ( - Gdk.EventProperty) –- Return type: - bool
 - 
do_proximity_in_event(event) virtual¶
- Parameters: - event ( - Gdk.EventProximity) –- Return type: - bool
 - 
do_proximity_out_event(event) virtual¶
- Parameters: - event ( - Gdk.EventProximity) –- Return type: - bool
 - 
do_query_tooltip(x, y, keyboard_tooltip, tooltip) virtual¶
- Parameters: - x (int) –
- y (int) –
- keyboard_tooltip (bool) –
- tooltip (Gtk.Tooltip) –
 - Return type: 
- x (
 - 
do_queue_draw_region(region) virtual¶
- Parameters: - region ( - cairo.Region) – region to draw- Invalidates the area of widget defined by region by calling - Gdk.Window.invalidate_region() on the widget’s window and all its child windows. Once the main loop becomes idle (after the current batch of events has been processed, roughly), the window will receive expose events for the union of all regions that have been invalidated.- Normally you would only use this function in widget implementations. You might also use it to schedule a redraw of a - Gtk.DrawingAreaor some portion thereof.- New in version 3.0. 
 - 
do_realize() virtual¶
- Creates the GDK (windowing system) resources associated with a widget. For example, widget->window will be created when a widget is realized. Normally realization happens implicitly; if you show a widget and all its parent containers, then the widget will be realized and mapped automatically. - Realizing a widget requires all the widget’s parent widgets to be realized; calling - Gtk.Widget.realize() realizes the widget’s parents in addition to widget itself. If a widget is not yet inside a toplevel window when you realize it, bad things will happen.- This function is primarily used in widget implementations, and isn’t very useful otherwise. Many times when you think you might need it, a better approach is to connect to a signal that will be called after the widget is realized automatically, such as - Gtk.Widget- ::draw. Or simply g_signal_connect () to the- Gtk.Widget- ::realizesignal.
 - 
do_screen_changed(previous_screen) virtual¶
- Parameters: - previous_screen ( - Gdk.Screen) –
 - 
do_scroll_event(event) virtual¶
- Parameters: - event ( - Gdk.EventScroll) –- Return type: - bool
 - 
do_selection_clear_event(event) virtual¶
- Parameters: - event ( - Gdk.EventSelection) –- Return type: - bool
 - 
do_selection_get(selection_data, info, time_) virtual¶
- Parameters: - selection_data (Gtk.SelectionData) –
- info (int) –
- time (int) –
 
- selection_data (
 - 
do_selection_notify_event(event) virtual¶
- Parameters: - event ( - Gdk.EventSelection) –- Return type: - bool
 - 
do_selection_received(selection_data, time_) virtual¶
- Parameters: - selection_data (Gtk.SelectionData) –
- time (int) –
 
- selection_data (
 - 
do_selection_request_event(event) virtual¶
- Parameters: - event ( - Gdk.EventSelection) –- Return type: - bool
 - 
do_show() virtual¶
- Flags a widget to be displayed. Any widget that isn’t shown will not appear on the screen. If you want to show all the widgets in a container, it’s easier to call - Gtk.Widget.show_all() on the container, instead of individually showing the widgets.- Remember that you have to show the containers containing a widget, in addition to the widget itself, before it will appear onscreen. - When a toplevel container is shown, it is immediately realized and mapped; other shown widgets are realized and mapped when their toplevel container is realized and mapped. 
 - 
do_show_all() virtual¶
- Recursively shows a widget, and any child widgets (if the widget is a container). 
 - 
do_show_help(help_type) virtual¶
- Parameters: - help_type ( - Gtk.WidgetHelpType) –- Return type: - bool
 - 
do_size_allocate(allocation) virtual¶
- Parameters: - allocation ( - Gdk.Rectangle) – position and size to be allocated to widget- This function is only used by - Gtk.Containersubclasses, to assign a size and position to their child widgets.- In this function, the allocation may be adjusted. It will be forced to a 1x1 minimum size, and the adjust_size_allocation virtual method on the child will be used to adjust the allocation. Standard adjustments include removing the widget’s margins, and applying the widget’s - Gtk.Widget- :halignand- Gtk.Widget- :valignproperties.- For baseline support in containers you need to use - Gtk.Widget.size_allocate_with_baseline() instead.
 - 
do_state_changed(previous_state) virtual¶
- Parameters: - previous_state ( - Gtk.StateType) –
 - 
do_state_flags_changed(previous_state_flags) virtual¶
- Parameters: - previous_state_flags ( - Gtk.StateFlags) –
 - 
do_style_updated() virtual¶
 - 
do_touch_event(event) virtual¶
- Parameters: - event ( - Gdk.EventTouch) –- Return type: - bool
 - 
do_unmap() virtual¶
- This function is only for use in widget implementations. Causes a widget to be unmapped if it’s currently mapped. 
 - 
do_unmap_event(event) virtual¶
- Parameters: - event ( - Gdk.EventAny) –- Return type: - bool
 - 
do_unrealize() virtual¶
- This function is only useful in widget implementations. Causes a widget to be unrealized (frees all GDK resources associated with the widget, such as widget->window). 
 - 
do_visibility_notify_event(event) virtual¶
- Parameters: - event ( - Gdk.EventVisibility) –- Return type: - bool
 - 
do_window_state_event(event) virtual¶
- Parameters: - event ( - Gdk.EventWindowState) –- Return type: - bool
 
Signal Details¶
- 
Gtk.Widget.signals.accel_closures_changed(widget)¶
- Signal Name: - accel-closures-changed- Flags: - Parameters: - widget ( - Gtk.Widget) – The object which received the signal
- Signal Name: - button-press-event- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- event (Gdk.EventButton) – theGdk.EventButtonwhich triggered this signal.
 - Returns: - Trueto stop other handlers from being invoked for the event.- Falseto propagate the event further.- Return type: - The - ::button-press-eventsignal will be emitted when a button (typically from a mouse) is pressed.- To receive this signal, the - Gdk.Windowassociated to the widget needs to enable the- Gdk.EventMask.BUTTON_PRESS_MASKmask.- This signal will be sent to the grab widget if there is one. 
- widget (
- Signal Name: - button-release-event- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- event (Gdk.EventButton) – theGdk.EventButtonwhich triggered this signal.
 - Returns: - Trueto stop other handlers from being invoked for the event.- Falseto propagate the event further.- Return type: - The - ::button-release-eventsignal will be emitted when a button (typically from a mouse) is released.- To receive this signal, the - Gdk.Windowassociated to the widget needs to enable the- Gdk.EventMask.BUTTON_RELEASE_MASKmask.- This signal will be sent to the grab widget if there is one. 
- widget (
- 
Gtk.Widget.signals.can_activate_accel(widget, signal_id)¶
- Signal Name: - can-activate-accel- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- signal_id (int) – the ID of a signal installed on self
 - Returns: - Trueif the signal can be activated.- Return type: - Determines whether an accelerator that activates the signal identified by signal_id can currently be activated. This signal is present to allow applications and derived widgets to override the default - Gtk.Widgethandling for determining whether an accelerator can be activated.
- widget (
- 
Gtk.Widget.signals.child_notify(widget, child_property)¶
- Signal Name: - child-notify- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- child_property (GObject.ParamSpec) – theGObject.ParamSpecof the changed child property
 - The - ::child-notifysignal is emitted for each ‘child property [child-properties]’ that has changed on an object. The signal’s detail holds the property name.
- widget (
- 
Gtk.Widget.signals.composited_changed(widget)¶
- Signal Name: - composited-changed- Flags: - RUN_LAST,- ACTION,- DEPRECATED- Parameters: - widget ( - Gtk.Widget) – The object which received the signal- The - ::composited-changedsignal is emitted when the composited status of widgets screen changes. See- Gdk.Screen.is_composited().- Deprecated since version 3.22: Use - Gdk.Screen- ::composited-changedinstead.
- 
Gtk.Widget.signals.configure_event(widget, event)¶
- Signal Name: - configure-event- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- event (Gdk.EventConfigure) – theGdk.EventConfigurewhich triggered this signal.
 - Returns: - Trueto stop other handlers from being invoked for the event.- Falseto propagate the event further.- Return type: - The - ::configure-eventsignal will be emitted when the size, position or stacking of the widget’s window has changed.- To receive this signal, the - Gdk.Windowassociated to the widget needs to enable the- Gdk.EventMask.STRUCTURE_MASKmask. GDK will enable this mask automatically for all new windows.
- widget (
- 
Gtk.Widget.signals.damage_event(widget, event)¶
- Signal Name: - damage-event- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- event (Gdk.EventExpose) – theGdk.EventExposeevent
 - Returns: - Trueto stop other handlers from being invoked for the event.- Falseto propagate the event further.- Return type: - Emitted when a redirected window belonging to widget gets drawn into. The region/area members of the event shows what area of the redirected drawable was drawn into. - New in version 2.14. 
- widget (
- 
Gtk.Widget.signals.delete_event(widget, event)¶
- Signal Name: - delete-event- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- event (Gdk.Event) – the event which triggered this signal
 - Returns: - Trueto stop other handlers from being invoked for the event.- Falseto propagate the event further.- Return type: - The - ::delete-eventsignal is emitted if a user requests that a toplevel window is closed. The default handler for this signal destroys the window. Connecting- Gtk.Widget.hide_on_delete() to this signal will cause the window to be hidden instead, so that it can later be shown again without reconstructing it.
- widget (
- 
Gtk.Widget.signals.destroy(widget)¶
- Signal Name: - destroy- Flags: - RUN_CLEANUP,- NO_RECURSE,- NO_HOOKS- Parameters: - widget ( - Gtk.Widget) – The object which received the signal- Signals that all holders of a reference to the widget should release the reference that they hold. May result in finalization of the widget if all references are released. - This signal is not suitable for saving widget state. 
- 
Gtk.Widget.signals.destroy_event(widget, event)¶
- Signal Name: - destroy-event- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- event (Gdk.Event) – the event which triggered this signal
 - Returns: - Trueto stop other handlers from being invoked for the event.- Falseto propagate the event further.- Return type: - The - ::destroy-eventsignal is emitted when a- Gdk.Windowis destroyed. You rarely get this signal, because most widgets disconnect themselves from their window before they destroy it, so no widget owns the window at destroy time.- To receive this signal, the - Gdk.Windowassociated to the widget needs to enable the- Gdk.EventMask.STRUCTURE_MASKmask. GDK will enable this mask automatically for all new windows.
- widget (
- 
Gtk.Widget.signals.direction_changed(widget, previous_direction)¶
- Signal Name: - direction-changed- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- previous_direction (Gtk.TextDirection) – the previous text direction of widget
 - The - ::direction-changedsignal is emitted when the text direction of a widget changes.
- widget (
- 
Gtk.Widget.signals.drag_begin(widget, context)¶
- Signal Name: - drag-begin- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- context (Gdk.DragContext) – the drag context
 - The - ::drag-beginsignal is emitted on the drag source when a drag is started. A typical reason to connect to this signal is to set up a custom drag icon with e.g.- Gtk.Widget.drag_source_set_icon_pixbuf().- Note that some widgets set up a drag icon in the default handler of this signal, so you may have to use g_signal_connect_after() to override what the default handler did. 
- widget (
- 
Gtk.Widget.signals.drag_data_delete(widget, context)¶
- Signal Name: - drag-data-delete- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- context (Gdk.DragContext) – the drag context
 - The - ::drag-data-deletesignal is emitted on the drag source when a drag with the action- Gdk.DragAction.MOVEis successfully completed. The signal handler is responsible for deleting the data that has been dropped. What “delete” means depends on the context of the drag operation.
- widget (
- 
Gtk.Widget.signals.drag_data_get(widget, context, data, info, time)¶
- Signal Name: - drag-data-get- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- context (Gdk.DragContext) – the drag context
- data (Gtk.SelectionData) – theGtk.SelectionDatato be filled with the dragged data
- info (int) – the info that has been registered with the target in theGtk.TargetList
- time (int) – the timestamp at which the data was requested
 - The - ::drag-data-getsignal is emitted on the drag source when the drop site requests the data which is dragged. It is the responsibility of the signal handler to fill data with the data in the format which is indicated by info. See- Gtk.SelectionData.set() and- Gtk.SelectionData.set_text().
- widget (
- 
Gtk.Widget.signals.drag_data_received(widget, context, x, y, data, info, time)¶
- Signal Name: - drag-data-received- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- context (Gdk.DragContext) – the drag context
- x (int) – where the drop happened
- y (int) – where the drop happened
- data (Gtk.SelectionData) – the received data
- info (int) – the info that has been registered with the target in theGtk.TargetList
- time (int) – the timestamp at which the data was received
 - The - ::drag-data-receivedsignal is emitted on the drop site when the dragged data has been received. If the data was received in order to determine whether the drop will be accepted, the handler is expected to call- Gdk.drag_status() and not finish the drag. If the data was received in response to a- Gtk.Widget- ::drag-dropsignal (and this is the last target to be received), the handler for this signal is expected to process the received data and then call- Gtk.drag_finish(), setting the success parameter depending on whether the data was processed successfully.- Applications must create some means to determine why the signal was emitted and therefore whether to call - Gdk.drag_status() or- Gtk.drag_finish().- The handler may inspect the selected action with - Gdk.DragContext.get_selected_action() before calling- Gtk.drag_finish(), e.g. to implement- Gdk.DragAction.ASKas shown in the following example:- void drag_data_received (GtkWidget *widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *data, guint info, guint time) { if ((data->length >= 0) && (data->format == 8)) { GdkDragAction action; // handle data here action = gdk_drag_context_get_selected_action (context); if (action == GDK_ACTION_ASK) { GtkWidget *dialog; gint response; dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_YES_NO, "Move the data ?\n"); response = gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); if (response == GTK_RESPONSE_YES) action = GDK_ACTION_MOVE; else action = GDK_ACTION_COPY; } gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time); } else gtk_drag_finish (context, FALSE, FALSE, time); } 
- widget (
- 
Gtk.Widget.signals.drag_drop(widget, context, x, y, time)¶
- Signal Name: - drag-drop- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- context (Gdk.DragContext) – the drag context
- x (int) – the x coordinate of the current cursor position
- y (int) – the y coordinate of the current cursor position
- time (int) – the timestamp of the motion event
 - Returns: - whether the cursor position is in a drop zone - Return type: - The - ::drag-dropsignal is emitted on the drop site when the user drops the data onto the widget. The signal handler must determine whether the cursor position is in a drop zone or not. If it is not in a drop zone, it returns- Falseand no further processing is necessary. Otherwise, the handler returns- True. In this case, the handler must ensure that- Gtk.drag_finish() is called to let the source know that the drop is done. The call to- Gtk.drag_finish() can be done either directly or in a- Gtk.Widget- ::drag-data-receivedhandler which gets triggered by calling- Gtk.Widget.drag_get_data() to receive the data for one or more of the supported targets.
- widget (
- 
Gtk.Widget.signals.drag_end(widget, context)¶
- Signal Name: - drag-end- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- context (Gdk.DragContext) – the drag context
 - The - ::drag-endsignal is emitted on the drag source when a drag is finished. A typical reason to connect to this signal is to undo things done in- Gtk.Widget- ::drag-begin.
- widget (
- 
Gtk.Widget.signals.drag_failed(widget, context, result)¶
- Signal Name: - drag-failed- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- context (Gdk.DragContext) – the drag context
- result (Gtk.DragResult) – the result of the drag operation
 - Returns: - Trueif the failed drag operation has been already handled.- Return type: - The - ::drag-failedsignal is emitted on the drag source when a drag has failed. The signal handler may hook custom code to handle a failed DnD operation based on the type of error, it returns- Trueis the failure has been already handled (not showing the default “drag operation failed” animation), otherwise it returns- False.- New in version 2.12. 
- widget (
- 
Gtk.Widget.signals.drag_leave(widget, context, time)¶
- Signal Name: - drag-leave- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- context (Gdk.DragContext) – the drag context
- time (int) – the timestamp of the motion event
 - The - ::drag-leavesignal is emitted on the drop site when the cursor leaves the widget. A typical reason to connect to this signal is to undo things done in- Gtk.Widget- ::drag-motion, e.g. undo highlighting with- Gtk.Widget.drag_unhighlight().- Likewise, the - Gtk.Widget- ::drag-leavesignal is also emitted before the- ::drag-dropsignal, for instance to allow cleaning up of a preview item created in the- Gtk.Widget- ::drag-motionsignal handler.
- widget (
- 
Gtk.Widget.signals.drag_motion(widget, context, x, y, time)¶
- Signal Name: - drag-motion- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- context (Gdk.DragContext) – the drag context
- x (int) – the x coordinate of the current cursor position
- y (int) – the y coordinate of the current cursor position
- time (int) – the timestamp of the motion event
 - Returns: - whether the cursor position is in a drop zone - Return type: - The - ::drag-motionsignal is emitted on the drop site when the user moves the cursor over the widget during a drag. The signal handler must determine whether the cursor position is in a drop zone or not. If it is not in a drop zone, it returns- Falseand no further processing is necessary. Otherwise, the handler returns- True. In this case, the handler is responsible for providing the necessary information for displaying feedback to the user, by calling- Gdk.drag_status().- If the decision whether the drop will be accepted or rejected can’t be made based solely on the cursor position and the type of the data, the handler may inspect the dragged data by calling - Gtk.Widget.drag_get_data() and defer the- Gdk.drag_status() call to the- Gtk.Widget- ::drag-data-receivedhandler. Note that you must pass- Gtk.DestDefaults.DROP,- Gtk.DestDefaults.MOTIONor- Gtk.DestDefaults.ALLto- Gtk.Widget.drag_dest_set() when using the drag-motion signal that way.- Also note that there is no drag-enter signal. The drag receiver has to keep track of whether he has received any drag-motion signals since the last - Gtk.Widget- ::drag-leaveand if not, treat the drag-motion signal as an “enter” signal. Upon an “enter”, the handler will typically highlight the drop site with- Gtk.Widget.drag_highlight().- static void drag_motion (GtkWidget *widget, GdkDragContext *context, gint x, gint y, guint time) { GdkAtom target; PrivateData *private_data = GET_PRIVATE_DATA (widget); if (!private_data->drag_highlight) { private_data->drag_highlight = 1; gtk_drag_highlight (widget); } target = gtk_drag_dest_find_target (widget, context, NULL); if (target == GDK_NONE) gdk_drag_status (context, 0, time); else { private_data->pending_status = gdk_drag_context_get_suggested_action (context); gtk_drag_get_data (widget, context, target, time); } return TRUE; } static void drag_data_received (GtkWidget *widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *selection_data, guint info, guint time) { PrivateData *private_data = GET_PRIVATE_DATA (widget); if (private_data->suggested_action) { private_data->suggested_action = 0; // We are getting this data due to a request in drag_motion, // rather than due to a request in drag_drop, so we are just // supposed to call gdk_drag_status(), not actually paste in // the data. str = gtk_selection_data_get_text (selection_data); if (!data_is_acceptable (str)) gdk_drag_status (context, 0, time); else gdk_drag_status (context, private_data->suggested_action, time); } else { // accept the drop } } 
- widget (
- 
Gtk.Widget.signals.draw(widget, cr)¶
- Signal Name: - draw- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- cr (cairo.Context) – the cairo context to draw to
 - Returns: - Trueto stop other handlers from being invoked for the event.- Falseto propagate the event further.- Return type: - This signal is emitted when a widget is supposed to render itself. The widget’s top left corner must be painted at the origin of the passed in context and be sized to the values returned by - Gtk.Widget.get_allocated_width() and- Gtk.Widget.get_allocated_height().- Signal handlers connected to this signal can modify the cairo context passed as cr in any way they like and don’t need to restore it. The signal emission takes care of calling - cairo.Context.save() before and- cairo.Context.restore() after invoking the handler.- The signal handler will get a cr with a clip region already set to the widget’s dirty region, i.e. to the area that needs repainting. Complicated widgets that want to avoid redrawing themselves completely can get the full extents of the clip region with - Gdk.cairo_get_clip_rectangle(), or they can get a finer-grained representation of the dirty region with- cairo.Context.copy_clip_rectangle_list().- New in version 3.0. 
- widget (
- 
Gtk.Widget.signals.enter_notify_event(widget, event)¶
- Signal Name: - enter-notify-event- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- event (Gdk.EventCrossing) – theGdk.EventCrossingwhich triggered this signal.
 - Returns: - Trueto stop other handlers from being invoked for the event.- Falseto propagate the event further.- Return type: - The - ::enter-notify-eventwill be emitted when the pointer enters the widget’s window.- To receive this signal, the - Gdk.Windowassociated to the widget needs to enable the- Gdk.EventMask.ENTER_NOTIFY_MASKmask.- This signal will be sent to the grab widget if there is one. 
- widget (
- 
Gtk.Widget.signals.event(widget, event)¶
- Signal Name: - event- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- event (Gdk.Event) – theGdk.Eventwhich triggered this signal
 - Returns: - Trueto stop other handlers from being invoked for the event and to cancel the emission of the second specific- ::eventsignal.- Falseto propagate the event further and to allow the emission of the second signal. The- ::event-aftersignal is emitted regardless of the return value.- Return type: - The GTK+ main loop will emit three signals for each GDK event delivered to a widget: one generic - ::eventsignal, another, more specific, signal that matches the type of event delivered (e.g.- Gtk.Widget- ::key-press-event) and finally a generic- Gtk.Widget- ::event-aftersignal.
- widget (
- 
Gtk.Widget.signals.event_after(widget, event)¶
- Signal Name: - event-after- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- event (Gdk.Event) – theGdk.Eventwhich triggered this signal
 - After the emission of the - Gtk.Widget- ::eventsignal and (optionally) the second more specific signal,- ::event-afterwill be emitted regardless of the previous two signals handlers return values.
- widget (
- 
Gtk.Widget.signals.focus(widget, direction)¶
- Signal Name: - focus- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- direction (Gtk.DirectionType) –
 - Returns: - Trueto stop other handlers from being invoked for the event.- Falseto propagate the event further.- Return type: 
- widget (
- 
Gtk.Widget.signals.focus_in_event(widget, event)¶
- Signal Name: - focus-in-event- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- event (Gdk.EventFocus) – theGdk.EventFocuswhich triggered this signal.
 - Returns: - Trueto stop other handlers from being invoked for the event.- Falseto propagate the event further.- Return type: - The - ::focus-in-eventsignal will be emitted when the keyboard focus enters the widget’s window.- To receive this signal, the - Gdk.Windowassociated to the widget needs to enable the- Gdk.EventMask.FOCUS_CHANGE_MASKmask.
- widget (
- 
Gtk.Widget.signals.focus_out_event(widget, event)¶
- Signal Name: - focus-out-event- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- event (Gdk.EventFocus) – theGdk.EventFocuswhich triggered this signal.
 - Returns: - Trueto stop other handlers from being invoked for the event.- Falseto propagate the event further.- Return type: - The - ::focus-out-eventsignal will be emitted when the keyboard focus leaves the widget’s window.- To receive this signal, the - Gdk.Windowassociated to the widget needs to enable the- Gdk.EventMask.FOCUS_CHANGE_MASKmask.
- widget (
- 
Gtk.Widget.signals.grab_broken_event(widget, event)¶
- Signal Name: - grab-broken-event- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- event (Gdk.EventGrabBroken) – theGdk.EventGrabBrokenevent
 - Returns: - Trueto stop other handlers from being invoked for the event.- Falseto propagate the event further.- Return type: - Emitted when a pointer or keyboard grab on a window belonging to widget gets broken. - On X11, this happens when the grab window becomes unviewable (i.e. it or one of its ancestors is unmapped), or if the same application grabs the pointer or keyboard again. - New in version 2.8. 
- widget (
- 
Gtk.Widget.signals.grab_focus(widget)¶
- Signal Name: - grab-focus- Flags: - RUN_LAST,- ACTION- Parameters: - widget ( - Gtk.Widget) – The object which received the signal
- 
Gtk.Widget.signals.grab_notify(widget, was_grabbed)¶
- Signal Name: - grab-notify- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- was_grabbed (bool) –Falseif the widget becomes shadowed,Trueif it becomes unshadowed
 - The - ::grab-notifysignal is emitted when a widget becomes shadowed by a GTK+ grab (not a pointer or keyboard grab) on another widget, or when it becomes unshadowed due to a grab being removed.- A widget is shadowed by a - Gtk.Widget.grab_add() when the topmost grab widget in the grab stack of its window group is not its ancestor.
- widget (
- 
Gtk.Widget.signals.hide(widget)¶
- Signal Name: - hide- Flags: - RUN_FIRST- Parameters: - widget ( - Gtk.Widget) – The object which received the signal- The - ::hidesignal is emitted when widget is hidden, for example with- Gtk.Widget.hide().
- 
Gtk.Widget.signals.hierarchy_changed(widget, previous_toplevel)¶
- Signal Name: - hierarchy-changed- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- previous_toplevel (Gtk.WidgetorNone) – the previous toplevel ancestor, orNoneif the widget was previously unanchored
 - The - ::hierarchy-changedsignal is emitted when the anchored state of a widget changes. A widget is “anchored” when its toplevel ancestor is a- Gtk.Window. This signal is emitted when a widget changes from un-anchored to anchored or vice-versa.
- widget (
- 
Gtk.Widget.signals.key_press_event(widget, event)¶
- Signal Name: - key-press-event- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- event (Gdk.EventKey) – theGdk.EventKeywhich triggered this signal.
 - Returns: - Trueto stop other handlers from being invoked for the event.- Falseto propagate the event further.- Return type: - The - ::key-press-eventsignal is emitted when a key is pressed. The signal emission will reoccur at the key-repeat rate when the key is kept pressed.- To receive this signal, the - Gdk.Windowassociated to the widget needs to enable the- Gdk.EventMask.KEY_PRESS_MASKmask.- This signal will be sent to the grab widget if there is one. 
- widget (
- 
Gtk.Widget.signals.key_release_event(widget, event)¶
- Signal Name: - key-release-event- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- event (Gdk.EventKey) – theGdk.EventKeywhich triggered this signal.
 - Returns: - Trueto stop other handlers from being invoked for the event.- Falseto propagate the event further.- Return type: - The - ::key-release-eventsignal is emitted when a key is released.- To receive this signal, the - Gdk.Windowassociated to the widget needs to enable the- Gdk.EventMask.KEY_RELEASE_MASKmask.- This signal will be sent to the grab widget if there is one. 
- widget (
- Signal Name: - keynav-failed- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- direction (Gtk.DirectionType) – the direction of movement
 - Returns: - Trueif stopping keyboard navigation is fine,- Falseif the emitting widget should try to handle the keyboard navigation attempt in its parent container(s).- Return type: - Gets emitted if keyboard navigation fails. See - Gtk.Widget.keynav_failed() for details.- New in version 2.12. 
- widget (
- 
Gtk.Widget.signals.leave_notify_event(widget, event)¶
- Signal Name: - leave-notify-event- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- event (Gdk.EventCrossing) – theGdk.EventCrossingwhich triggered this signal.
 - Returns: - Trueto stop other handlers from being invoked for the event.- Falseto propagate the event further.- Return type: - The - ::leave-notify-eventwill be emitted when the pointer leaves the widget’s window.- To receive this signal, the - Gdk.Windowassociated to the widget needs to enable the- Gdk.EventMask.LEAVE_NOTIFY_MASKmask.- This signal will be sent to the grab widget if there is one. 
- widget (
- 
Gtk.Widget.signals.map(widget)¶
- Signal Name: - map- Flags: - RUN_FIRST- Parameters: - widget ( - Gtk.Widget) – The object which received the signal- The - ::mapsignal is emitted when widget is going to be mapped, that is when the widget is visible (which is controlled with- Gtk.Widget.set_visible()) and all its parents up to the toplevel widget are also visible. Once the map has occurred,- Gtk.Widget- ::map-eventwill be emitted.- The - ::mapsignal can be used to determine whether a widget will be drawn, for instance it can resume an animation that was stopped during the emission of- Gtk.Widget- ::unmap.
- 
Gtk.Widget.signals.map_event(widget, event)¶
- Signal Name: - map-event- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- event (Gdk.EventAny) – theGdk.EventAnywhich triggered this signal.
 - Returns: - Trueto stop other handlers from being invoked for the event.- Falseto propagate the event further.- Return type: - The - ::map-eventsignal will be emitted when the widget’s window is mapped. A window is mapped when it becomes visible on the screen.- To receive this signal, the - Gdk.Windowassociated to the widget needs to enable the- Gdk.EventMask.STRUCTURE_MASKmask. GDK will enable this mask automatically for all new windows.
- widget (
- 
Gtk.Widget.signals.mnemonic_activate(widget, group_cycling)¶
- Signal Name: - mnemonic-activate- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- group_cycling (bool) –Trueif there are other widgets with the same mnemonic
 - Returns: - Trueto stop other handlers from being invoked for the event.- Falseto propagate the event further.- Return type: - The default handler for this signal activates widget if group_cycling is - False, or just makes widget grab focus if group_cycling is- True.
- widget (
- 
Gtk.Widget.signals.motion_notify_event(widget, event)¶
- Signal Name: - motion-notify-event- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- event (Gdk.EventMotion) – theGdk.EventMotionwhich triggered this signal.
 - Returns: - Trueto stop other handlers from being invoked for the event.- Falseto propagate the event further.- Return type: - The - ::motion-notify-eventsignal is emitted when the pointer moves over the widget’s- Gdk.Window.- To receive this signal, the - Gdk.Windowassociated to the widget needs to enable the- Gdk.EventMask.POINTER_MOTION_MASKmask.- This signal will be sent to the grab widget if there is one. 
- widget (
- 
Gtk.Widget.signals.move_focus(widget, direction)¶
- Signal Name: - move-focus- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- direction (Gtk.DirectionType) –
 
- widget (
- 
Gtk.Widget.signals.parent_set(widget, old_parent)¶
- Signal Name: - parent-set- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- old_parent (Gtk.WidgetorNone) – the previous parent, orNoneif the widget just got its initial parent.
 - The - ::parent-setsignal is emitted when a new parent has been set on a widget.
- widget (
- Signal Name: - popup-menu- Flags: - RUN_LAST,- ACTION- Parameters: - widget ( - Gtk.Widget) – The object which received the signal- Returns: - Trueif a menu was activated- Return type: - bool- This signal gets emitted whenever a widget should pop up a context menu. This usually happens through the standard key binding mechanism; by pressing a certain key while a widget is focused, the user can cause the widget to pop up a menu. For example, the - Gtk.Entrywidget creates a menu with clipboard commands. See the Popup Menu Migration Checklist for an example of how to use this signal.
- 
Gtk.Widget.signals.property_notify_event(widget, event)¶
- Signal Name: - property-notify-event- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- event (Gdk.EventProperty) – theGdk.EventPropertywhich triggered this signal.
 - Returns: - Trueto stop other handlers from being invoked for the event.- Falseto propagate the event further.- Return type: - The - ::property-notify-eventsignal will be emitted when a property on the widget’s window has been changed or deleted.- To receive this signal, the - Gdk.Windowassociated to the widget needs to enable the- Gdk.EventMask.PROPERTY_CHANGE_MASKmask.
- widget (
- 
Gtk.Widget.signals.proximity_in_event(widget, event)¶
- Signal Name: - proximity-in-event- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- event (Gdk.EventProximity) – theGdk.EventProximitywhich triggered this signal.
 - Returns: - Trueto stop other handlers from being invoked for the event.- Falseto propagate the event further.- Return type: - To receive this signal the - Gdk.Windowassociated to the widget needs to enable the- Gdk.EventMask.PROXIMITY_IN_MASKmask.- This signal will be sent to the grab widget if there is one. 
- widget (
- 
Gtk.Widget.signals.proximity_out_event(widget, event)¶
- Signal Name: - proximity-out-event- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- event (Gdk.EventProximity) – theGdk.EventProximitywhich triggered this signal.
 - Returns: - Trueto stop other handlers from being invoked for the event.- Falseto propagate the event further.- Return type: - To receive this signal the - Gdk.Windowassociated to the widget needs to enable the- Gdk.EventMask.PROXIMITY_OUT_MASKmask.- This signal will be sent to the grab widget if there is one. 
- widget (
- 
Gtk.Widget.signals.query_tooltip(widget, x, y, keyboard_mode, tooltip)¶
- Signal Name: - query-tooltip- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- x (int) – the x coordinate of the cursor position where the request has been emitted, relative to widget’s left side
- y (int) – the y coordinate of the cursor position where the request has been emitted, relative to widget’s top
- keyboard_mode (bool) –Trueif the tooltip was triggered using the keyboard
- tooltip (Gtk.Tooltip) – aGtk.Tooltip
 - Returns: - Return type: - Emitted when - Gtk.Widget- :has-tooltipis- Trueand the hover timeout has expired with the cursor hovering “above” widget; or emitted when widget got focus in keyboard mode.- Using the given coordinates, the signal handler should determine whether a tooltip should be shown for widget. If this is the case - Trueshould be returned,- Falseotherwise. Note that if keyboard_mode is- True, the values of x and y are undefined and should not be used.- The signal handler is free to manipulate tooltip with the therefore destined function calls. - New in version 2.12. 
- widget (
- 
Gtk.Widget.signals.realize(widget)¶
- Signal Name: - realize- Flags: - RUN_FIRST- Parameters: - widget ( - Gtk.Widget) – The object which received the signal- The - ::realizesignal is emitted when widget is associated with a- Gdk.Window, which means that- Gtk.Widget.realize() has been called or the widget has been mapped (that is, it is going to be drawn).
- 
Gtk.Widget.signals.screen_changed(widget, previous_screen)¶
- Signal Name: - screen-changed- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- previous_screen (Gdk.ScreenorNone) – the previous screen, orNoneif the widget was not associated with a screen before
 - The - ::screen-changedsignal gets emitted when the screen of a widget has changed.
- widget (
- 
Gtk.Widget.signals.scroll_event(widget, event)¶
- Signal Name: - scroll-event- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- event (Gdk.EventScroll) – theGdk.EventScrollwhich triggered this signal.
 - Returns: - Trueto stop other handlers from being invoked for the event.- Falseto propagate the event further.- Return type: - The - ::scroll-eventsignal is emitted when a button in the 4 to 7 range is pressed. Wheel mice are usually configured to generate button press events for buttons 4 and 5 when the wheel is turned.- To receive this signal, the - Gdk.Windowassociated to the widget needs to enable the- Gdk.EventMask.SCROLL_MASKmask.- This signal will be sent to the grab widget if there is one. 
- widget (
- 
Gtk.Widget.signals.selection_clear_event(widget, event)¶
- Signal Name: - selection-clear-event- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- event (Gdk.EventSelection) – theGdk.EventSelectionwhich triggered this signal.
 - Returns: - Trueto stop other handlers from being invoked for the event.- Falseto propagate the event further.- Return type: - The - ::selection-clear-eventsignal will be emitted when the the widget’s window has lost ownership of a selection.
- widget (
- 
Gtk.Widget.signals.selection_get(widget, data, info, time)¶
- Signal Name: - selection-get- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- data (Gtk.SelectionData) –
- info (int) –
- time (int) –
 
- widget (
- 
Gtk.Widget.signals.selection_notify_event(widget, event)¶
- Signal Name: - selection-notify-event- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- event (Gdk.EventSelection) –
 - Returns: - Trueto stop other handlers from being invoked for the event.- Falseto propagate the event further.- Return type: 
- widget (
- 
Gtk.Widget.signals.selection_received(widget, data, time)¶
- Signal Name: - selection-received- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- data (Gtk.SelectionData) –
- time (int) –
 
- widget (
- 
Gtk.Widget.signals.selection_request_event(widget, event)¶
- Signal Name: - selection-request-event- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- event (Gdk.EventSelection) – theGdk.EventSelectionwhich triggered this signal.
 - Returns: - Trueto stop other handlers from being invoked for the event.- Falseto propagate the event further.- Return type: - The - ::selection-request-eventsignal will be emitted when another client requests ownership of the selection owned by the widget’s window.
- widget (
- 
Gtk.Widget.signals.show(widget)¶
- Signal Name: - show- Flags: - RUN_FIRST- Parameters: - widget ( - Gtk.Widget) – The object which received the signal- The - ::showsignal is emitted when widget is shown, for example with- Gtk.Widget.show().
- 
Gtk.Widget.signals.show_help(widget, help_type)¶
- Signal Name: - show-help- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- help_type (Gtk.WidgetHelpType) –
 - Returns: - Trueto stop other handlers from being invoked for the event.- Falseto propagate the event further.- Return type: 
- widget (
- 
Gtk.Widget.signals.size_allocate(widget, allocation)¶
- Signal Name: - size-allocate- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- allocation (Gdk.Rectangle) – the region which has been allocated to the widget.
 
- widget (
- 
Gtk.Widget.signals.state_changed(widget, state)¶
- Signal Name: - state-changed- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- state (Gtk.StateType) – the previous state
 - The - ::state-changedsignal is emitted when the widget state changes. See- Gtk.Widget.get_state().- Deprecated since version 3.0: Use - Gtk.Widget- ::state-flags-changedinstead.
- widget (
- 
Gtk.Widget.signals.state_flags_changed(widget, flags)¶
- Signal Name: - state-flags-changed- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- flags (Gtk.StateFlags) – The previous state flags.
 - The - ::state-flags-changedsignal is emitted when the widget state changes, see- Gtk.Widget.get_state_flags().- New in version 3.0. 
- widget (
- 
Gtk.Widget.signals.style_set(widget, previous_style)¶
- Signal Name: - style-set- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- previous_style (Gtk.StyleorNone) – the previous style, orNoneif the widget just got its initial style
 - The - ::style-setsignal is emitted when a new style has been set on a widget. Note that style-modifying functions like- Gtk.Widget.modify_base() also cause this signal to be emitted.- Note that this signal is emitted for changes to the deprecated - Gtk.Style. To track changes to the- Gtk.StyleContextassociated with a widget, use the- Gtk.Widget- ::style-updatedsignal.- Deprecated since version 3.0: Use the - Gtk.Widget- ::style-updatedsignal
- widget (
- 
Gtk.Widget.signals.style_updated(widget)¶
- Signal Name: - style-updated- Flags: - RUN_FIRST- Parameters: - widget ( - Gtk.Widget) – The object which received the signal- The - ::style-updatedsignal is a convenience signal that is emitted when the- Gtk.StyleContext- ::changedsignal is emitted on the widget’s associated- Gtk.StyleContextas returned by- Gtk.Widget.get_style_context().- Note that style-modifying functions like - Gtk.Widget.override_color() also cause this signal to be emitted.- New in version 3.0. 
- 
Gtk.Widget.signals.touch_event(widget, object)¶
- Signal Name: - touch-event- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- object (Gdk.Event) –
 - Return type: 
- widget (
- 
Gtk.Widget.signals.unmap(widget)¶
- Signal Name: - unmap- Flags: - RUN_FIRST- Parameters: - widget ( - Gtk.Widget) – The object which received the signal- The - ::unmapsignal is emitted when widget is going to be unmapped, which means that either it or any of its parents up to the toplevel widget have been set as hidden.- As - ::unmapindicates that a widget will not be shown any longer, it can be used to, for example, stop an animation on the widget.
- 
Gtk.Widget.signals.unmap_event(widget, event)¶
- Signal Name: - unmap-event- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- event (Gdk.EventAny) – theGdk.EventAnywhich triggered this signal
 - Returns: - Trueto stop other handlers from being invoked for the event.- Falseto propagate the event further.- Return type: - The - ::unmap-eventsignal will be emitted when the widget’s window is unmapped. A window is unmapped when it becomes invisible on the screen.- To receive this signal, the - Gdk.Windowassociated to the widget needs to enable the- Gdk.EventMask.STRUCTURE_MASKmask. GDK will enable this mask automatically for all new windows.
- widget (
- 
Gtk.Widget.signals.unrealize(widget)¶
- Signal Name: - unrealize- Flags: - RUN_LAST- Parameters: - widget ( - Gtk.Widget) – The object which received the signal- The - ::unrealizesignal is emitted when the- Gdk.Windowassociated with widget is destroyed, which means that- Gtk.Widget.unrealize() has been called or the widget has been unmapped (that is, it is going to be hidden).
- 
Gtk.Widget.signals.visibility_notify_event(widget, event)¶
- Signal Name: - visibility-notify-event- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- event (Gdk.EventVisibility) – theGdk.EventVisibilitywhich triggered this signal.
 - Returns: - Trueto stop other handlers from being invoked for the event.- Falseto propagate the event further.- Return type: - The - ::visibility-notify-eventwill be emitted when the widget’s window is obscured or unobscured.- To receive this signal the - Gdk.Windowassociated to the widget needs to enable the- Gdk.EventMask.VISIBILITY_NOTIFY_MASKmask.- Deprecated since version 3.12: Modern composited windowing systems with pervasive transparency make it impossible to track the visibility of a window reliably, so this signal can not be guaranteed to provide useful information. 
- widget (
- 
Gtk.Widget.signals.window_state_event(widget, event)¶
- Signal Name: - window-state-event- Flags: - Parameters: - widget (Gtk.Widget) – The object which received the signal
- event (Gdk.EventWindowState) – theGdk.EventWindowStatewhich triggered this signal.
 - Returns: - Trueto stop other handlers from being invoked for the event.- Falseto propagate the event further.- Return type: - The - ::window-state-eventwill be emitted when the state of the toplevel window associated to the widget changes.- To receive this signal the - Gdk.Windowassociated to the widget needs to enable the- Gdk.EventMask.STRUCTURE_MASKmask. GDK will enable this mask automatically for all new windows.
- widget (
Property Details¶
- 
Gtk.Widget.props.app_paintable¶
- Name: - app-paintable- Type: - bool- Default Value: - False- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Whether the application will paint directly on the widget 
- 
Gtk.Widget.props.can_default¶
- Name: - can-default- Type: - bool- Default Value: - False- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Whether the widget can be the default widget 
- 
Gtk.Widget.props.can_focus¶
- Name: - can-focus- Type: - bool- Default Value: - False- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Whether the widget can accept the input focus 
- 
Gtk.Widget.props.composite_child¶
- Name: - composite-child- Type: - bool- Default Value: - False- Flags: - READABLE- Whether the widget is part of a composite widget 
- 
Gtk.Widget.props.double_buffered¶
- Name: - double-buffered- Type: - bool- Default Value: - True- Flags: - DEPRECATED,- READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Whether the widget is double buffered. - New in version 2.18. - Deprecated since version 3.14: Widgets should not use this property. 
- 
Gtk.Widget.props.events¶
- Name: - events- Type: - Gdk.EventMask- Default Value: - Gdk.EventMask.STRUCTURE_MASK|- Gdk.EventMask.ALL_EVENTS_MASK- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- The event mask that decides what kind of GdkEvents this widget gets 
- 
Gtk.Widget.props.expand¶
- Name: - expand- Type: - bool- Default Value: - False- Flags: - READABLE,- WRITABLE- Whether to expand in both directions. Setting this sets both - Gtk.Widget- :hexpandand- Gtk.Widget- :vexpand- New in version 3.0. 
- 
Gtk.Widget.props.focus_on_click¶
- Name: - focus-on-click- Type: - bool- Default Value: - True- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Whether the widget should grab focus when it is clicked with the mouse. - This property is only relevant for widgets that can take focus. - Before 3.20, several widgets ( - Gtk.Button,- Gtk.FileChooserButton,- Gtk.ComboBox) implemented this property individually.- New in version 3.20. 
- 
Gtk.Widget.props.halign¶
- Name: - halign- Type: - Gtk.Align- Default Value: - Gtk.Align.FILL- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- How to distribute horizontal space if widget gets extra space, see - Gtk.Align- New in version 3.0. 
- 
Gtk.Widget.props.has_default¶
- Name: - has-default- Type: - bool- Default Value: - False- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Whether the widget is the default widget 
- 
Gtk.Widget.props.has_focus¶
- Name: - has-focus- Type: - bool- Default Value: - False- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Whether the widget has the input focus 
- 
Gtk.Widget.props.has_tooltip¶
- Name: - has-tooltip- Type: - bool- Default Value: - False- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Enables or disables the emission of - Gtk.Widget- ::query-tooltipon widget. A value of- Trueindicates that widget can have a tooltip, in this case the widget will be queried using- Gtk.Widget- ::query-tooltipto determine whether it will provide a tooltip or not.- Note that setting this property to - Truefor the first time will change the event masks of the GdkWindows of this widget to include leave-notify and motion-notify events. This cannot and will not be undone when the property is set to- Falseagain.- New in version 2.12. 
- 
Gtk.Widget.props.height_request¶
- Name: - height-request- Type: - int- Default Value: - -1- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Override for height request of the widget, or -1 if natural request should be used 
- 
Gtk.Widget.props.hexpand¶
- Name: - hexpand- Type: - bool- Default Value: - False- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Whether to expand horizontally. See - Gtk.Widget.set_hexpand().- New in version 3.0. 
- 
Gtk.Widget.props.hexpand_set¶
- Name: - hexpand-set- Type: - bool- Default Value: - False- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Whether to use the - Gtk.Widget- :hexpandproperty. See- Gtk.Widget.get_hexpand_set().- New in version 3.0. 
- 
Gtk.Widget.props.is_focus¶
- Name: - is-focus- Type: - bool- Default Value: - False- Flags: - READABLE,- WRITABLE- Whether the widget is the focus widget within the toplevel 
- 
Gtk.Widget.props.margin¶
- Name: - margin- Type: - int- Default Value: - 0- Flags: - READABLE,- WRITABLE- Sets all four sides’ margin at once. If read, returns max margin on any side. - New in version 3.0. 
- 
Gtk.Widget.props.margin_bottom¶
- Name: - margin-bottom- Type: - int- Default Value: - 0- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Margin on bottom side of widget. - This property adds margin outside of the widget’s normal size request, the margin will be added in addition to the size from - Gtk.Widget.set_size_request() for example.- New in version 3.0. 
- 
Gtk.Widget.props.margin_end¶
- Name: - margin-end- Type: - int- Default Value: - 0- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Margin on end of widget, horizontally. This property supports left-to-right and right-to-left text directions. - This property adds margin outside of the widget’s normal size request, the margin will be added in addition to the size from - Gtk.Widget.set_size_request() for example.- New in version 3.12. 
- 
Gtk.Widget.props.margin_left¶
- Name: - margin-left- Type: - int- Default Value: - 0- Flags: - DEPRECATED,- READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Margin on left side of widget. - This property adds margin outside of the widget’s normal size request, the margin will be added in addition to the size from - Gtk.Widget.set_size_request() for example.- New in version 3.0. - Deprecated since version 3.12: Use - Gtk.Widget- :margin-startinstead.
- 
Gtk.Widget.props.margin_right¶
- Name: - margin-right- Type: - int- Default Value: - 0- Flags: - DEPRECATED,- READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Margin on right side of widget. - This property adds margin outside of the widget’s normal size request, the margin will be added in addition to the size from - Gtk.Widget.set_size_request() for example.- New in version 3.0. - Deprecated since version 3.12: Use - Gtk.Widget- :margin-endinstead.
- 
Gtk.Widget.props.margin_start¶
- Name: - margin-start- Type: - int- Default Value: - 0- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Margin on start of widget, horizontally. This property supports left-to-right and right-to-left text directions. - This property adds margin outside of the widget’s normal size request, the margin will be added in addition to the size from - Gtk.Widget.set_size_request() for example.- New in version 3.12. 
- 
Gtk.Widget.props.margin_top¶
- Name: - margin-top- Type: - int- Default Value: - 0- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Margin on top side of widget. - This property adds margin outside of the widget’s normal size request, the margin will be added in addition to the size from - Gtk.Widget.set_size_request() for example.- New in version 3.0. 
- 
Gtk.Widget.props.name¶
- Name: - name- Type: - str- Default Value: - None- Flags: - READABLE,- WRITABLE- The name of the widget 
- 
Gtk.Widget.props.no_show_all¶
- Name: - no-show-all- Type: - bool- Default Value: - False- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Whether - Gtk.Widget.show_all() should not affect this widget
- 
Gtk.Widget.props.opacity¶
- Name: - opacity- Type: - float- Default Value: - 1.0- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- The requested opacity of the widget. See - Gtk.Widget.set_opacity() for more details about window opacity.- Before 3.8 this was only available in - Gtk.Window- New in version 3.8. 
- 
Gtk.Widget.props.parent¶
- Name: - parent- Type: - Gtk.Container- Default Value: - None- Flags: - READABLE,- WRITABLE- The parent widget of this widget. Must be a Container widget 
- 
Gtk.Widget.props.receives_default¶
- Name: - receives-default- Type: - bool- Default Value: - False- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- If - True, the widget will receive the default action when it is focused
- 
Gtk.Widget.props.scale_factor¶
- Name: - scale-factor- Type: - int- Default Value: - 1- Flags: - READABLE- The scale factor of the widget. See - Gtk.Widget.get_scale_factor() for more details about widget scaling.- New in version 3.10. 
- 
Gtk.Widget.props.sensitive¶
- Name: - sensitive- Type: - bool- Default Value: - True- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Whether the widget responds to input 
- 
Gtk.Widget.props.style¶
- Name: - style- Type: - Gtk.Style- Default Value: - None- Flags: - DEPRECATED,- READABLE,- WRITABLE- The style of the widget, which contains information about how it will look (colors, etc). - Deprecated since version ???: Use - Gtk.StyleContextinstead
- 
Gtk.Widget.props.tooltip_markup¶
- Name: - tooltip-markup- Type: - str- Default Value: - None- Flags: - READABLE,- WRITABLE- Sets the text of tooltip to be the given string, which is marked up with the Pango text markup language. Also see - Gtk.Tooltip.set_markup().- This is a convenience property which will take care of getting the tooltip shown if the given string is not - None:- Gtk.Widget- :has-tooltipwill automatically be set to- Trueand there will be taken care of- Gtk.Widget- ::query-tooltipin the default signal handler.- Note that if both - Gtk.Widget- :tooltip-textand- Gtk.Widget- :tooltip-markupare set, the last one wins.- New in version 2.12. 
- 
Gtk.Widget.props.tooltip_text¶
- Name: - tooltip-text- Type: - str- Default Value: - None- Flags: - READABLE,- WRITABLE- Sets the text of tooltip to be the given string. - Also see - Gtk.Tooltip.set_text().- This is a convenience property which will take care of getting the tooltip shown if the given string is not - None:- Gtk.Widget- :has-tooltipwill automatically be set to- Trueand there will be taken care of- Gtk.Widget- ::query-tooltipin the default signal handler.- Note that if both - Gtk.Widget- :tooltip-textand- Gtk.Widget- :tooltip-markupare set, the last one wins.- New in version 2.12. 
- 
Gtk.Widget.props.valign¶
- Name: - valign- Type: - Gtk.Align- Default Value: - Gtk.Align.FILL- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- How to distribute vertical space if widget gets extra space, see - Gtk.Align- New in version 3.0. 
- 
Gtk.Widget.props.vexpand¶
- Name: - vexpand- Type: - bool- Default Value: - False- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Whether to expand vertically. See - Gtk.Widget.set_vexpand().- New in version 3.0. 
- 
Gtk.Widget.props.vexpand_set¶
- Name: - vexpand-set- Type: - bool- Default Value: - False- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Whether to use the - Gtk.Widget- :vexpandproperty. See- Gtk.Widget.get_vexpand_set().- New in version 3.0. 
- 
Gtk.Widget.props.visible¶
- Name: - visible- Type: - bool- Default Value: - False- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Whether the widget is visible 
- 
Gtk.Widget.props.width_request¶
- Name: - width-request- Type: - int- Default Value: - -1- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Override for width request of the widget, or -1 if natural request should be used 
- 
Gtk.Widget.props.window¶
- Name: - window- Type: - Gdk.Window- Default Value: - None- Flags: - READABLE- The widget’s window if it is realized, - Noneotherwise.- New in version 2.14.