Skip to content

Window

from slint import Window
python

A window that renders the scene of a component on the screen. To get the window of a component, use window.

take_snapshot() -> Image

Takes a snapshot of the window contents and returns it as an image. To get a snapshot in the size of your component, show the window first.

Raises RuntimeError if the backend or renderer can’t take snapshots, or if the component of the window no longer exists.

Note: This function can be slow, because it re-renders the scene when needed.

Example of saving a screenshot with Pillow:

import slint
from PIL import Image
import numpy as np
main_window = slint.loader.app.MainWindow()
main_window.show()
snapshot = main_window.window.take_snapshot()
Image.fromarray(np.asarray(snapshot)).save("screenshot.png")
python

© 2026 SixtyFPS GmbH