Window
Inherits: BaseControl
Controls the app window.
Limitation
This control is for Desktop platforms (macOS, Windows, Linux) only.
Properties
-
alignment(Optional[Alignment]) –Defines the alignment of the app window.
-
always_on_bottom(bool) –Whether the app window should always be displayed below other windows.
-
always_on_top(bool) –Whether the app window should always be displayed on top of other windows/apps.
-
aspect_ratio(Optional[Number]) –Defines the aspect ratio of the app window.
-
badge_label(Optional[str]) –Sets a badge label on the app window.
-
bgcolor(Optional[ColorValue]) –Sets background color of an application window.
-
brightness(Optional[Brightness]) –The brightness of a app window.
-
focused(bool) –Whether the app window should be focused.
-
frameless(bool) –Whether the app window should be frameless.
-
full_screen(bool) –Whether to switch the app's window to fullscreen mode.
-
height(Optional[Number]) –Defines the height of the app window.
-
icon(Optional[str]) –The icon of the app window.
-
ignore_mouse_events(bool) –Whether the app window should ignore mouse events, passing them to the window below it. If this window has focus, it will still receive keyboard events.
-
left(Optional[Number]) –Defines the horizontal position of the app window - a distance in virtual pixels from the left edge of the screen.
-
max_height(Optional[Number]) –Defines the maximum height of the app window.
-
max_width(Optional[Number]) –Defines the maximum width of the app window.
-
maximizable(bool) –Whether to hide/disable app window's "Maximize" button.
-
maximized(bool) –Whether the app window is maximized.
-
min_height(Optional[Number]) –Defines the minimum height of the app window.
-
min_width(Optional[Number]) –Defines the minimum width of the app window.
-
minimizable(bool) –Whether the app window can be minimized through the window's "Minimize" button.
-
minimized(bool) –Whether the app window is minimized.
-
movable(bool) –Whether the app window can be moved.
-
opacity(Number) –Defines the opacity of the app window.
-
prevent_close(bool) –Set to
Trueto intercept the native close signal. -
progress_bar(Optional[Number]) –The value from
0.0to1.0to display a progress bar on Task Bar or Dock. -
resizable(bool) –Whether the app window can be resized.
-
shadow(bool) –Whether to display a shadow around the app window.
-
skip_task_bar(bool) –Whether the app window should be hidden from the Task Bar (on Windows) or Dock (on macOS).
-
title_bar_buttons_hidden(bool) –Whether to hide the app window's title bar buttons.
-
title_bar_hidden(bool) –Whether to hide the app window's title bar.
-
top(Optional[Number]) –Defines the vertical position of a native OS window - a distance in virtual pixels from the top edge of the screen.
-
visible(bool) –Whether to make the app window visible.
-
width(Optional[Number]) –Defines the width of the app window.
Events
-
on_event(Optional[EventHandler[WindowEvent]]) –Called when app window changes its state.
Methods
-
center–Centers the app window.
-
close– -
destroy–Destroys the app window.
-
start_dragging–Starts dragging the app window.
-
start_resizing–Starts resizing the app window.
-
to_front–Brings the app window to the front.
-
wait_until_ready_to_show–Waits until the app window is ready to show.
Properties#
alignment
class-attribute
instance-attribute
#
Defines the alignment of the app window.
always_on_bottom
class-attribute
instance-attribute
#
always_on_bottom: bool = False
Whether the app window should always be displayed below other windows.
Limitation
Has effect on Linux and Windows only.
always_on_top
class-attribute
instance-attribute
#
always_on_top: bool = False
Whether the app window should always be displayed on top of other windows/apps.
aspect_ratio
class-attribute
instance-attribute
#
Defines the aspect ratio of the app window.
badge_label
class-attribute
instance-attribute
#
Sets a badge label on the app window.
Limitation
Has effect on macOS only.
bgcolor
class-attribute
instance-attribute
#
bgcolor: Optional[ColorValue] = None
Sets background color of an application window.
Tip
Can be used together with Page.bgcolor to make
a window transparent.
brightness
class-attribute
instance-attribute
#
brightness: Optional[Brightness] = None
The brightness of a app window.
focused
class-attribute
instance-attribute
#
focused: bool = True
Whether the app window should be focused.
Set to True to focus programmatically.
frameless
class-attribute
instance-attribute
#
frameless: bool = False
Whether the app window should be frameless.
full_screen
class-attribute
instance-attribute
#
full_screen: bool = False
Whether to switch the app's window to fullscreen mode.
height
class-attribute
instance-attribute
#
Defines the height of the app window.
icon
class-attribute
instance-attribute
#
The icon of the app window.
The file should have the .ico extension.
Limitation
Has effect on Windows only.
ignore_mouse_events
class-attribute
instance-attribute
#
ignore_mouse_events: bool = False
Whether the app window should ignore mouse events, passing them to the window below it. If this window has focus, it will still receive keyboard events.
left
class-attribute
instance-attribute
#
Defines the horizontal position of the app window - a distance in virtual pixels from the left edge of the screen.
max_height
class-attribute
instance-attribute
#
Defines the maximum height of the app window.
max_width
class-attribute
instance-attribute
#
Defines the maximum width of the app window.
maximizable
class-attribute
instance-attribute
#
maximizable: bool = True
Whether to hide/disable app window's "Maximize" button.
maximized
class-attribute
instance-attribute
#
maximized: bool = False
Whether the app window is maximized.
Set to True to maximize programmatically.
min_height
class-attribute
instance-attribute
#
Defines the minimum height of the app window.
min_width
class-attribute
instance-attribute
#
Defines the minimum width of the app window.
minimizable
class-attribute
instance-attribute
#
minimizable: bool = True
Whether the app window can be minimized through the window's "Minimize" button.
minimized
class-attribute
instance-attribute
#
minimized: bool = False
Whether the app window is minimized.
Set to True to minimize programmatically.
movable
class-attribute
instance-attribute
#
movable: bool = True
Whether the app window can be moved.
Limitation
Has effect on macOS only.
opacity
class-attribute
instance-attribute
#
opacity: Number = 1.0
Defines the opacity of the app window.
Raises:
-
ValueError–If it is not between
0.0and1.0inclusive.
prevent_close
class-attribute
instance-attribute
#
prevent_close: bool = False
Set to True to intercept the native close signal.
Could be used to implement app exit confirmation logic.
progress_bar
class-attribute
instance-attribute
#
The value from 0.0 to 1.0 to display a progress bar on Task Bar or Dock.
resizable
class-attribute
instance-attribute
#
resizable: bool = True
Whether the app window can be resized.
shadow
class-attribute
instance-attribute
#
shadow: bool = True
Whether to display a shadow around the app window.
skip_task_bar
class-attribute
instance-attribute
#
skip_task_bar: bool = False
Whether the app window should be hidden from the Task Bar (on Windows) or Dock (on macOS).
title_bar_buttons_hidden
class-attribute
instance-attribute
#
title_bar_buttons_hidden: bool = False
Whether to hide the app window's title bar buttons.
Limitation
Has effect on macOS only.
title_bar_hidden
class-attribute
instance-attribute
#
title_bar_hidden: bool = False
Whether to hide the app window's title bar.
top
class-attribute
instance-attribute
#
Defines the vertical position of a native OS window - a distance in virtual pixels from the top edge of the screen.
visible
class-attribute
instance-attribute
#
visible: bool = True
Whether to make the app window visible.
Can be of use when the app starts as hidden.
width
class-attribute
instance-attribute
#
Defines the width of the app window.
Events#
on_event
class-attribute
instance-attribute
#
on_event: Optional[EventHandler[WindowEvent]] = None
Called when app window changes its state. For example, when the window is maximized or minimized.
Methods#
wait_until_ready_to_show
async
#
Waits until the app window is ready to show.