Window
Window represents a weak reference a slint::Window in your application.
Use the properties to inspect the window state and use root_element
in combination with query_descendants to locate UI elements.
Properties
Section titled “Properties”is_minimized
Section titled “is_minimized”is_minimized: boolRead-only property that holds the minimize state of the Window.
is_maximized
Section titled “is_maximized”is_maximized: boolRead-only property that holds the maximize state of the Window.
is_fullscreen
Section titled “is_fullscreen”is_fullscreen: boolRead-only property that returns true if the window is shown fullscreen.
size: Tuple[int, int]Read-only property that returns size of the Window in physical pixels, as a tuple of width and height.
position
Section titled “position”position: Tuple[int, int]Read-only property that returns position of the Window on the screen in physical pixels, as a tuple of x and y.
root_element
Section titled “root_element”root_element: ElementRead-only property that returns the Window’s root element
Methods
Section titled “Methods”find_elements_by_id
Section titled “find_elements_by_id”find_elements_by_id(id: str) -> list[Element]grab_window_as_png
Section titled “grab_window_as_png”grab_window_as_png() -> bytesGrabs a screenshot of the window and returns it as PNG encoded image.
grab_window_with_mime_type
Section titled “grab_window_with_mime_type”grab_window_with_mime_type(image_mime_type: str) -> bytesGrabs a screenshot of the window and returns it as image encoded in the supplied format. For this to succeed, make sure that the application is used with Slint where support for the desired image format is enabled.
For Rust applications, image/png and image/jpeg are enabled by default. Additional formats
can be enabled via the image crate ↗ as well as the
image-default-formats ↗ feature flag.
For C++, JavaScript, and Python applications, by default image/bmp, image/gif, image/vnd.radiance,
image/x-icon, image/jpeg, image/x-exr, image/png, image/x-portable-bitmap, image/x-qoi,
image/x-targa, image/tiff and image/webp are supported.
dispatch_event
Section titled “dispatch_event”dispatch_event(event: PointerPressEvent | PointerReleaseEvent | PointerMoveEvent | PointerScrolledEvent | PointerExitedEvent | KeyPressedEvent | KeyPressRepeatedEvent | KeyReleasedEvent)Dispatches one of the possible event types to the window. Use this for low-level control to simulate user input.
drag_and_drop
Section titled “drag_and_drop”drag_and_drop(start: LogicalPosition, end: LogicalPosition, button: PointerEventButton = PointerEventButton.Left, steps: int = 10) -> NoneSimulates a drag-and-drop interaction by dispatching a pointer press at start,
a sequence of steps interpolated pointer moves ending at end, and finally a
pointer release at end.
Use steps to control granularity of the motion. The last move event lands exactly
on end so handlers that read the pointer position on release see the expected
location.
- start: Start position in logical pixels.
- end: End position in logical pixels.
- button: The button to press during the drag. Defaults to the left button.
- steps: Number of interpolated pointer move events between
startandend. Must be at least 1.
© 2026 SixtyFPS GmbH