This release is a pre-release and may not be stable for production use.
Slint-python (Beta)
Slint is a UI toolkit that supports different programming languages. Slint-python is the integration with Python.
Warning Slint-python is in a beta phase of development: The APIs while mostly stable, may be subject to further changes. Any changes will be documented in the ChangeLog.
You can track the progress for the Python integration by looking at python-labelled issues at https://github.com/slint-ui/slint/labels/a%3Alanguage-python .
Slint Language Manual
The Slint Language Documentation covers the Slint UI description language in detail.
Prerequisites
Installation
Install Slint with uv or pip from the Python Package Index:
uv add slint
The installation uses binaries provided for macOS, Windows, and Linux for various architectures. If your target platform
is not covered by binaries, uv will automatically build Slint from source. If that happens, you will then need some
software development tools on your machine, as well as Rust.
Quick Start
- Create a new project with
uv init. - Add the Slint Python package to your Python project:
uv add slint - Create a file called
app-window.slint:
import { Button, VerticalBox } from "std-widgets.slint";
export component AppWindow inherits Window {
in-out property<int> counter: 42;
callback request-increase-value();
VerticalBox {
Text {
text: "Counter: \{root.counter}";
}
Button {
text: "Increase value";
clicked => {
root.request-increase-value();
}
}
}
}
- Create a file called
main.py:
import slint
# slint.loader will look in `sys.path` for `app-window.slint`.
class App(slint.loader.app_window.AppWindow):
@slint.callback
def request_increase_value(self):
self.counter = self.counter + 1
app = App()
app.run()
- Run it with
uv run main.py
API Overview
Instantiating a Component
The following example shows how to instantiate a Slint component in Python:
app.slint
export component MainWindow inherits Window {
callback clicked <=> i-touch-area.clicked;
in property <int> counter;
width: 400px;
height: 200px;
i-touch-area := TouchArea {}
}
The exported component is exposed as a Python class. To access this class, you have two options:
-
Call
slint.load_file("app.slint"). The returned object is a namespace, that provides theMainWindowclass as well as any other explicitly exported component that inheritsWindow:import slint components = slint.load_file("app.slint") main_window = components.MainWindow()
-
Use Slint's auto-loader, which lazily loads
.slintfiles fromsys.path:import slint # Look for for `app.slint` in `sys.path`: main_window = slint.loader.app.MainWindow()
Any attribute lookup in
slint.loaderis searched for insys.path. If a directory with the name exists, it is returned as a loader object, and subsequent attribute lookups follow the same logic.If the name matches a file with the
.slintextension, it is automatically loaded withload_fileand the namespace is returned.If the file name contains a dash, like
app-window.slint, an attribute lookup forapp_windowtries to locateapp_window.slintand then fall back toapp-window.slint.
Accessing Properties
Properties declared as out or in-out in .slint files are visible as
properties on the component instance.
main_window.counter = 42
print(main_window.counter)
Accessing Globals
Global Singletons are accessible in Python as properties in the component instance.
For example, this Slint code declares a PrinterJobQueue singleton:
export global PrinterJobQueue {
in-out property <int> job-count;
}
Access it as a property on the component instance by its name:
print("job count:", instance.PrinterJobQueue.job_count)
Note: Global singletons are instantiated once per component. When declaring multiple components for export to Python,
each instance has their own associated globals singletons.
Setting and Invoking Callbacks
Callbacks declared in .slint files are visible as callable properties on the component
instance. Invoke them as functions to invoke the callback, and assign Python callables to set the callback handler.
In Slint, callbacks are defined using the callback keyword and can be connected to another component's callback using
the <=> syntax.
my-component.slint
export component MyComponent inherits Window {
callback clicked <=> i-touch-area.clicked;
width: 400px;
height: 200px;
i-touch-area := TouchArea {}
}
The callbacks in Slint are exposed as properties and that can be called as functions.
main.py
import slint
component = slint.loader.my_component.MyComponent()
# connect to a callback
def clicked():
print("hello")
component.clicked = clicked
// invoke a callback
component.clicked();
Another way to set callbacks is to sub-class and use the @slint.callback decorator:
import slint
class Component(slint.loader.my_component.MyComponent):
@slint.callback
def clicked(self):
print("hello")
component = Component()
The @slint.callback() decorator accepts a name argument, if the name of the method does not match the name of the
callback in the .slint file. Similarly, a global_name argument can be used to bind a method to a callback in a global
singleton.
Type Mappings
Each type used for properties in the Slint Language translates to a specific type in Python. See the type mappings table in the Slint Python documentation for the complete list.
Arrays and Models
You can set array properties from Python by passing subclasses of
slint.Model.
Use the slint.ListModel class to construct a model from an iterable:
component.model = slint.ListModel([1, 2, 3])
component.model.append(4)
del component.model[0]
When sub-classing slint.Model, provide the following methods:
def row_count(self):
"""Return the number of rows in your model"""
def row_data(self, row):
"""Return data at specified row"""
def set_row_data(self, row, data):
"""For read-write models, store data in the given row. When done call set.notify_row_changed:"
..."""
self.notify_row_changed(row)
When adding or inserting rows, call notify_row_added(row, count) on the super class. Similarly, when removing rows, notify
Slint by calling notify_row_removed(row, count).
Structs
Structs declared in Slint and exposed to Python via export are then accessible in the namespace that is returned
when instantiating a component.
app.slint
export struct MyData {
name: string,
age: int
}
export component MainWindow inherits Window {
in-out property <MyData> data;
}
main.py
The exported MyData struct can be constructed as follows:
import slint
# Look for for `app.slint` in `sys.path`:
main_window = slint.loader.app.MainWindow()
data = slint.loader.app.MyData(name="Simon")
data.age = 10
main_window.data = data
Enums
Enums declared in Slint and exposed to Python via export are then accessible in the namespace that is returned
when instantiating a component. The enums are subclasses of enum.Enum.
app.slint
export enum MyOption {
Variant1,
Variant2
}
export component MainWindow inherits Window {
in-out property <MyOption> data;
}
main.py
Variants of the exported MyOption enum can be constructed as follows:
import slint
# Look for for `app.slint` in `sys.path`:
main_window = slint.loader.app.MainWindow()
value = slint.loader.app.MyOption.Variant2
main_window.data = value
Asynchronous I/O
Use Python's asyncio library to write concurrent Python code with the async/await syntax.
Slint's event loop is a full-featured asyncio event loop. While
the event loop is running, asyncio.get_event_loop() returns
a valid loop. To run an async function when starting the loop, pass a coroutine to slint.run_event_loop().
For the common use case of interacting with REST APIs, we recommend the aiohttp library.
Known Limitations
- Pipes and sub-processes are only supported on Unix-like platforms.
Type Hints
PEP 484 introduces a standard syntax for type annotations to Python, enabling static analysis for type checking, refactoring, and code completion. Popular type checkers include mypy, Pyre, and Astral's ty.
Use Slint's slint-compiler to generate stub .py files for .slint files, which are annotated with
type information. These replace the need to call load_file or any use of slint.loader.
- Create a new project with
uv init. - Add the Slint Python package to your Python project:
uv add slint - Create a file called
app-window.slint:
import { Button, VerticalBox } from "std-widgets.slint";
export component AppWindow inherits Window {
in-out property<int> counter: 42;
callback request-increase-value();
VerticalBox {
Text {
text: "Counter: \{root.counter}";
}
Button {
text: "Increase value";
clicked => {
root.request-increase-value();
}
}
}
}
-
Run the slint-compiler to generate
app_window.py:uvx slint-compiler -f python -o app_window.py app-window.slint -
Create a file called
main.py:
import slint
import app_window
class App(app_window.AppWindow):
@slint.callback
def request_increase_value(self):
self.counter = self.counter + 1
app = App()
app.run()
- Run it with
uv run main.py
Third-Party Licenses
For a list of the third-party licenses of all dependencies, see the separate Third-Party Licenses page.
Release files for slint 1.18.1b1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| slint-1.18.1b1.tar.gz | 2.9 MB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| slint-1.18.1b1-cp311-abi3-win_amd64.whl | CPython 3.11 | abi3 | Windows x86-64 | Details |
| slint-1.18.1b1-cp311-abi3-musllinux_1_2_x86_64.whl | CPython 3.11 | abi3 | Linux musl 1.2+ x86-64 | Details |
| slint-1.18.1b1-cp311-abi3-musllinux_1_2_aarch64.whl | CPython 3.11 | abi3 | Linux musl 1.2+ ARM64 | Details |
| slint-1.18.1b1-cp311-abi3-manylinux_2_35_x86_64.whl | CPython 3.11 | abi3 | Linux glibc 2.35+ x86-64 | Details |
| slint-1.18.1b1-cp311-abi3-manylinux_2_31_armv7l.whl | CPython 3.11 | abi3 | Linux glibc 2.31+ ARMv7l | Details |
| slint-1.18.1b1-cp311-abi3-manylinux_2_31_aarch64.whl | CPython 3.11 | abi3 | Linux glibc 2.31+ ARM64 | Details |
| slint-1.18.1b1-cp311-abi3-macosx_11_0_arm64.whl | CPython 3.11 | abi3 | macOS 11.0+ ARM64 | Details |
| slint-1.18.1b1-cp311-abi3-ios_13_0_arm64_iphonesimulator.whl | CPython 3.11 | abi3 | iOS 13.0+ ARM64 Simulator | Details |
| slint-1.18.1b1-cp311-abi3-ios_13_0_arm64_iphoneos.whl | CPython 3.11 | abi3 | iOS 13.0+ ARM64 Device | Details |
Total release size: 127.8 MB
Release files / slint-1.18.1b1.tar.gz
| Download URL | slint-1.18.1b1.tar.gz |
|---|---|
| Size | 2.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
99cfa315923242cd13b1f54867ba1f7ca3e960a6b0f5b88f475482e2c52bd634
|
|
BLAKE2b-256 checksum How to use checksums |
775456ddfda0474a426871495aa630a94551076fbb1b0719c2e723ba4b93a2dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.
Transparency logRelease files / slint-1.18.1b1-cp311-abi3-win_amd64.whl
| Download URL | slint-1.18.1b1-cp311-abi3-win_amd64.whl |
|---|---|
| Size | 12.5 MB |
| Tags | CPython 3.11 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
124d6587c47ea9276a372657da78e0473f9e38b5b84d721b8390c08078091fbf
|
|
BLAKE2b-256 checksum How to use checksums |
490108592028ab039fe560571abf0d583e4effbcc67cf0492c6c405141432c3d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.
Transparency logRelease files / slint-1.18.1b1-cp311-abi3-musllinux_1_2_x86_64.whl
| Download URL | slint-1.18.1b1-cp311-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 15.9 MB |
| Tags | CPython 3.11 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
61999a7179fbdbbf6f6b900962b8e9d68dbed780ffe6d782946489b3a6fa56bd
|
|
BLAKE2b-256 checksum How to use checksums |
c47011d0b333fa4ed7a4f94aac0c5e96dd728e75b550b10b95f2c35b4ca5eca8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.
Transparency logRelease files / slint-1.18.1b1-cp311-abi3-musllinux_1_2_aarch64.whl
| Download URL | slint-1.18.1b1-cp311-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 15.6 MB |
| Tags | CPython 3.11 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
56f95c1fdb922823ba9d77c05ce09bc514303d82cc1e7746ec631f3d6b7dd981
|
|
BLAKE2b-256 checksum How to use checksums |
dcd956b1e86a60d1114561cd28ae10b4ac7b6057d8027adb8a8f4c5187b9d929
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.
Transparency logRelease files / slint-1.18.1b1-cp311-abi3-manylinux_2_35_x86_64.whl
| Download URL | slint-1.18.1b1-cp311-abi3-manylinux_2_35_x86_64.whl |
|---|---|
| Size | 15.4 MB |
| Tags | CPython 3.11 Linux glibc 2.35+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
272b5d10ae1682dc455ade7d1c9bcedd9112daf0897794a6573759310335cb3d
|
|
BLAKE2b-256 checksum How to use checksums |
05cda0694640c60a9ffc3572b8366686162fee146f26638247b9cb402cc28c9f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.
Transparency logRelease files / slint-1.18.1b1-cp311-abi3-manylinux_2_31_armv7l.whl
| Download URL | slint-1.18.1b1-cp311-abi3-manylinux_2_31_armv7l.whl |
|---|---|
| Size | 15.1 MB |
| Tags | CPython 3.11 Linux glibc 2.31+ ARMv7l abi3 |
|
SHA-256 checksum How to use checksums |
d55a7f25c90793fbfbd46290a264a9134a662c0653dc009b277c76dd74cc2cbd
|
|
BLAKE2b-256 checksum How to use checksums |
1bcef5f3caef34ea275909ad3afb205f29346db9ed0ab2492817f508674f7d0c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.
Transparency logRelease files / slint-1.18.1b1-cp311-abi3-manylinux_2_31_aarch64.whl
| Download URL | slint-1.18.1b1-cp311-abi3-manylinux_2_31_aarch64.whl |
|---|---|
| Size | 15.0 MB |
| Tags | CPython 3.11 Linux glibc 2.31+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
08b32bab732cd4d47611b5d400d5eabda66619b9980264394336b363a327b1cc
|
|
BLAKE2b-256 checksum How to use checksums |
03b04cdf2a2cebf10394fe400e9fc0a1ffdc0bd1549da8e58567029bab4a9c92
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.
Transparency logRelease files / slint-1.18.1b1-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | slint-1.18.1b1-cp311-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 11.6 MB |
| Tags | CPython 3.11 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
d88d0a35c0f341e4d4af2ed18dcbaba4e5d0d4690ca8ac13a05d738f7d7abd5c
|
|
BLAKE2b-256 checksum How to use checksums |
b06dd7e2ded4947d8d0b74cdded959b2efafed49fdb0921a797a5e84f31bdf88
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.
Transparency logRelease files / slint-1.18.1b1-cp311-abi3-ios_13_0_arm64_iphonesimulator.whl
| Download URL | slint-1.18.1b1-cp311-abi3-ios_13_0_arm64_iphonesimulator.whl |
|---|---|
| Size | 12.0 MB |
| Tags | CPython 3.11 abi3 iOS 13.0+ ARM64 Simulator |
|
SHA-256 checksum How to use checksums |
09d3e4dcc2820849f18ba3e272e402000d7074a2549b7e918b611b32ee3a45da
|
|
BLAKE2b-256 checksum How to use checksums |
6aa6472caab347910e33465968adcac2a09a9904d24bc0575b464bfab0fcf551
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.
Transparency logRelease files / slint-1.18.1b1-cp311-abi3-ios_13_0_arm64_iphoneos.whl
| Download URL | slint-1.18.1b1-cp311-abi3-ios_13_0_arm64_iphoneos.whl |
|---|---|
| Size | 11.8 MB |
| Tags | CPython 3.11 abi3 iOS 13.0+ ARM64 Device |
|
SHA-256 checksum How to use checksums |
91c2468f9876587246dec8a64babcafc0c0537983ef9ec83d2c47b2bcee31a4f
|
|
BLAKE2b-256 checksum How to use checksums |
84a4cf76be332f96805977094e076626a43d60642f43372a39626dffda49f149
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.
Transparency log