Skip to content

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.

is_minimized: bool

Read-only property that holds the minimize state of the Window.

is_maximized: bool

Read-only property that holds the maximize state of the Window.

is_fullscreen: bool

Read-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: 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: Element

Read-only property that returns the Window’s root element

find_elements_by_id(id: str) -> list[Element]
grab_window_as_png() -> bytes

Grabs a screenshot of the window and returns it as PNG encoded image.

grab_window_with_mime_type(image_mime_type: str) -> bytes

Grabs 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.

Dispatches one of the possible event types to the window. Use this for low-level control to simulate user input.

drag_and_drop(start: LogicalPosition, end: LogicalPosition, button: PointerEventButton = PointerEventButton.Left, steps: int = 10) -> None

Simulates 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 start and end. Must be at least 1.

© 2026 SixtyFPS GmbH