---
title: "Window"
---
import XRef from "../../../../components/XRef.astro";
import Signature from "../../../../components/Signature.astro";

```python
from slint import Window
```

A window that renders the scene of a component on the screen.
To get the window of a component, use <XRef to="Component.window" />.

## Methods

### take_snapshot

<Signature symbol="slint.slint.Window.take_snapshot">take_snapshot() -&gt; <XRef to="slint.slint.Image" plain /></Signature>

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:
```python
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")
```