Skip to main content
Pre-release

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

  1. Create a new project with uv init.
  2. Add the Slint Python package to your Python project: uv add slint
  3. 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();
            }
        }
    }
}
  1. 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()
  1. 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:

  1. Call slint.load_file("app.slint"). The returned object is a namespace, that provides the MainWindow class as well as any other explicitly exported component that inherits Window:

    import slint
    
    components = slint.load_file("app.slint")
    main_window = components.MainWindow()
    
  2. Use Slint's auto-loader, which lazily loads .slint files from sys.path:

    import slint
    
    # Look for for `app.slint` in `sys.path`:
    main_window = slint.loader.app.MainWindow()
    

    Any attribute lookup in slint.loader is searched for in sys.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 .slint extension, it is automatically loaded with load_file and the namespace is returned.

    If the file name contains a dash, like app-window.slint, an attribute lookup for app_window tries to locate app_window.slint and then fall back to app-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.

  1. Create a new project with uv init.
  2. Add the Slint Python package to your Python project: uv add slint
  3. 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();
            }
        }
    }
}
  1. Run the slint-compiler to generate app_window.py: uvx slint-compiler -f python -o app_window.py app-window.slint

  2. 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()
  1. 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.0b1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for slint 1.18.0b1
File Size Uploaded
slint-1.18.0b1.tar.gz 2.9 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for slint 1.18.0b1
File
slint-1.18.0b1-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details
slint-1.18.0b1-cp311-abi3-musllinux_1_2_x86_64.whl CPython 3.11 abi3 Linux musl 1.2+ x86-64 Details
slint-1.18.0b1-cp311-abi3-musllinux_1_2_aarch64.whl CPython 3.11 abi3 Linux musl 1.2+ ARM64 Details
slint-1.18.0b1-cp311-abi3-manylinux_2_35_x86_64.whl CPython 3.11 abi3 Linux glibc 2.35+ x86-64 Details
slint-1.18.0b1-cp311-abi3-manylinux_2_31_armv7l.whl CPython 3.11 abi3 Linux glibc 2.31+ ARMv7l Details
slint-1.18.0b1-cp311-abi3-manylinux_2_31_aarch64.whl CPython 3.11 abi3 Linux glibc 2.31+ ARM64 Details
slint-1.18.0b1-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details
slint-1.18.0b1-cp311-abi3-ios_13_0_arm64_iphonesimulator.whl CPython 3.11 abi3 iOS 13.0+ ARM64 Simulator Details
slint-1.18.0b1-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.0b1.tar.gz

Download URL slint-1.18.0b1.tar.gz
Size 2.9 MB
Tags Source
SHA-256 checksum
How to use checksums
e57d6f3c52f0d02c67885d2e1fa443fc19c6359446bbb2b7de641cbd888f4c3e
BLAKE2b-256 checksum
How to use checksums
af61d474ce252f59026a9a79e131083357b54c405dcb8c6930682689109484e5
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 16, 2026.

Transparency log

Release files / slint-1.18.0b1-cp311-abi3-win_amd64.whl

Download URL slint-1.18.0b1-cp311-abi3-win_amd64.whl
Size 12.5 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
f6b46a3854d4a0e2db7f4298c3289703ae091f47fdb12c649bd439a5e5db4f1d
BLAKE2b-256 checksum
How to use checksums
4b0dae97ac831eaa14bfba30aeae93c360ea3dc72829fff8ecea77bc4ed50268
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 16, 2026.

Transparency log

Release files / slint-1.18.0b1-cp311-abi3-musllinux_1_2_x86_64.whl

Download URL slint-1.18.0b1-cp311-abi3-musllinux_1_2_x86_64.whl
Size 15.8 MB
Tags CPython 3.11 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
0883fed5628b680649c5b4b0f80de3477f6655784fa5b9ca8b76e09a4d6cce0f
BLAKE2b-256 checksum
How to use checksums
99af5cfd4569d1b62bc654de5b9692f33dfd3c7097f662a86ff61cfe985e1344
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 16, 2026.

Transparency log

Release files / slint-1.18.0b1-cp311-abi3-musllinux_1_2_aarch64.whl

Download URL slint-1.18.0b1-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
1af64595ad6055da45cd9175e8a808becbf472ac05d747919d9d79fa25fb2b61
BLAKE2b-256 checksum
How to use checksums
b97faaac6620f1bbd190334383d2012bb5f2f54b868bd5ae2627fbda987e5acf
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 16, 2026.

Transparency log

Release files / slint-1.18.0b1-cp311-abi3-manylinux_2_35_x86_64.whl

Download URL slint-1.18.0b1-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
0ac4f8eada1bc0e38c4c411adb33cd056da5add69c849105ce360f72b1398bbd
BLAKE2b-256 checksum
How to use checksums
96197219419a8a8513543a5dcbb5efbec31f7e689ec261b57bc455618ef154ea
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 16, 2026.

Transparency log

Release files / slint-1.18.0b1-cp311-abi3-manylinux_2_31_armv7l.whl

Download URL slint-1.18.0b1-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
fdf2a51c28223b9f67dced9c8e905b40a6282117f7d37c4c03812f983f69d687
BLAKE2b-256 checksum
How to use checksums
51faeb8a60eba7092202a00fd1598dc885b5b33346abb6d356feb4851b30c30c
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 16, 2026.

Transparency log

Release files / slint-1.18.0b1-cp311-abi3-manylinux_2_31_aarch64.whl

Download URL slint-1.18.0b1-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
6eec9df83a509cf67a76053311d224d9c7ec3de7338a68688a735d219afaabac
BLAKE2b-256 checksum
How to use checksums
636e0fbd302f17c6422abf4d2bac6a22a3c8106dbe7aa96e78e9f40c5e8c1e7e
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 16, 2026.

Transparency log

Release files / slint-1.18.0b1-cp311-abi3-macosx_11_0_arm64.whl

Download URL slint-1.18.0b1-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
d40c0de937fa08311a87443a22a631b6c682b144fc46549bf43e9d6484fde013
BLAKE2b-256 checksum
How to use checksums
64ef26856543417a8d8799e179c291f15e805ccea40e6b6beab7fefa9d43f465
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 16, 2026.

Transparency log

Release files / slint-1.18.0b1-cp311-abi3-ios_13_0_arm64_iphonesimulator.whl

Download URL slint-1.18.0b1-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
99c999ab869398115d6231161c705d2e3ea2f640cfc8737f0c4f521044bc7519
BLAKE2b-256 checksum
How to use checksums
e1abfa12a9976e1bbfcc355b04b5d9ab57347a8c605cd254605f7921f9e4ea2d
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 16, 2026.

Transparency log

Release files / slint-1.18.0b1-cp311-abi3-ios_13_0_arm64_iphoneos.whl

Download URL slint-1.18.0b1-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
6c71f0c2f59443ed0c3d11eaedefc0dde7ce10f30c4da34858c6eb9a1ec1776a
BLAKE2b-256 checksum
How to use checksums
56a01bb2a109fb1be39c04d0b5276c74b5bdd441402bf57f8f080a9c0a1f3671
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 16, 2026.

Transparency log
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page