Window#
- class Window(*args, **kwargs)#
Superclasses: Window, Widget, InitiallyUnowned, Object
Subclasses: AboutWindow, PreferencesWindow
Implemented Interfaces: Accessible, Buildable, ConstraintTarget, Native, Root, ShortcutManager
A freeform window.
The AdwWindow widget is a subclass of Window which has no
titlebar area. Instead, ToolbarView can be used together with
HeaderBar or HeaderBar as follows:
<object class="AdwWindow">
<property name="content">
<object class="AdwToolbarView">
<child type="top">
<object class="AdwHeaderBar"/>
</child>
<property name="content">
<!-- ... -->
</property>
</object>
</property>
</object>
Using titlebar or child
is not supported and will result in a crash. Use content
instead.
Dialogs#
AdwWindow can contain Dialog. Use present with the
window or a widget within a window to show a dialog.
Breakpoints#
AdwWindow can be used with Breakpoint the same way as
BreakpointBin. Refer to that widget’s documentation for details.
Example:
<object class="AdwWindow">
<property name="content">
<object class="AdwToolbarView">
<child type="top">
<object class="AdwHeaderBar"/>
</child>
<property name="content">
<!-- ... -->
</property>
<child type="bottom">
<object class="GtkActionBar" id="bottom_bar">
<property name="revealed">True</property>
<property name="visible">False</property>
</object>
</child>
</object>
</property>
<child>
<object class="AdwBreakpoint">
<condition>max-width: 500px</condition>
<setter object="bottom_bar" property="visible">True</setter>
</object>
</child>
</object>
When breakpoints are used, the minimum size must be larger than the smallest
UI state. AdwWindow defaults to the minimum size of 360×200 px. If that’s
too small, set the width_request and
height_request properties manually.
Adaptive Preview#
AdwWindow has a debug tool called adaptive preview. It can be opened from
GTK Inspector or by pressing Ctrl+:kbd:Shift+:kbd:M,
and controlled via the adaptive_preview property.
Constructors#
Methods#
- class Window
- add_breakpoint(breakpoint: Breakpoint) None#
Adds
breakpointtoself.Added in version 1.4.
- Parameters:
breakpoint – the breakpoint to add
- get_adaptive_preview() bool#
Gets whether adaptive preview for
selfis currently open.Added in version 1.7.
- get_content() Widget | None#
Gets the content widget of
self.This method should always be used instead of
get_child.
- get_current_breakpoint() Breakpoint | None#
Gets the current breakpoint.
Added in version 1.4.
- get_dialogs() ListModel#
Returns a
ListModelthat contains the open dialogs ofself.This can be used to keep an up-to-date view.
Added in version 1.5.
- get_visible_dialog() Dialog | None#
Returns the currently visible dialog in
self, if there’s one.Added in version 1.5.
- set_adaptive_preview(adaptive_preview: bool) None#
Sets whether adaptive preview for
selfis currently open.Adaptive preview is a debugging tool used for testing the window contents at specific screen sizes, simulating mobile environment.
Adaptive preview can always be accessed from inspector. This function allows applications to open it manually.
Most applications should not use this function.
Added in version 1.7.
- Parameters:
adaptive_preview – whether to open adaptive preview
Properties#
- class Window
- props.adaptive_preview: bool#
Whether adaptive preview is currently open.
Adaptive preview is a debugging tool used for testing the window contents at specific screen sizes, simulating mobile environment.
Adaptive preview can always be accessed from inspector. This function allows applications to open it manually.
Most applications should not use this property.
Added in version 1.7.
- props.current_breakpoint: Breakpoint#
The current breakpoint.
Added in version 1.4.
Fields#
- class Window
- parent_instance#