Skip to main content

Bindings for Iced, a cross-platform GUI library focused on simplicity. Inspired by Elm.

Project description

GitHub Workflow Status Documentation Status PyPI PyPI - Python Version OS - Windows | Linux License

Python bindings for Iced.

Iced is a cross-platform GUI library focused on simplicity and type-safety. Inspired by Elm.

Installation

Precompiled wheel:

$ pip install pyiced

From source:

$ pip install .

To install from source you need to have a recent version of Rust installed in your $PATH.

Rustup is probably the most easy to use option to install and update Rust on your system.

Quick Example

from pyiced import (
    Align, button, ButtonState, column, container, IcedApp, Length, text,
)


class ExampleApp(IcedApp):
    def __init__(self):
        self.__incr_button_state = ButtonState()
        self.__decr_button_state = ButtonState()
        self.__value = 0

    def title(self):
        return 'Counter'

    def view(self):
        increment_button = button(
            self.__incr_button_state,  # To track the state across redraws.
            text('Increment'),         # This is content on the button.
            on_press='incr',           # This value is received in update().
        )
        value_label = text(f'{self.__value}', size=50)
        decrement_button = button(
            self.__decr_button_state,
            text('Decrement'),
            on_press='decr',
        )
        return container(
            column(
                [increment_button, value_label, decrement_button],
                align_items=Align.CENTER,
            ),
            padding=20, align_x=Align.CENTER, align_y=Align.CENTER,
            width=Length.FILL, height=Length.FILL,
        )

    def update(self, msg, clipboard):
        # When an event occurs, this method is called.
        # It can optionally return a list of async functions,
        # to handle the event.
        match msg:
            case 'incr':
                self.__value += 1
            case 'decr':
                self.__value -= 1


if __name__ == '__main__':
    # This function only returns if there is an error on start-up.
    # Otherwise the program gets terminated when the window is closed.
    ExampleApp().run()

Bigger Example

Please find the source code in examples/chess.py.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pyiced, version 0.3.0a6
Filename, size File type Python version Upload date Hashes
Filename, size pyiced-0.3.0a6.tar.gz (75.2 kB) File type Source Python version None Upload date Hashes View
Filename, size pyiced-0.3.0a6-cp310-cp310-musllinux_1_1_x86_64.whl (5.7 MB) File type Wheel Python version cp310 Upload date Hashes View
Filename, size pyiced-0.3.0a6-cp310-cp310-manylinux_2_24_x86_64.whl (5.1 MB) File type Wheel Python version cp310 Upload date Hashes View
Filename, size pyiced-0.3.0a6-cp310-cp310-manylinux_2_24_i686.whl (5.4 MB) File type Wheel Python version cp310 Upload date Hashes View
Filename, size pyiced-0.3.0a6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.1 MB) File type Wheel Python version cp310 Upload date Hashes View
Filename, size pyiced-0.3.0a6-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl (5.4 MB) File type Wheel Python version cp310 Upload date Hashes View
Filename, size pyiced-0.3.0a6-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (5.1 MB) File type Wheel Python version cp310 Upload date Hashes View
Filename, size pyiced-0.3.0a6-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.whl (5.4 MB) File type Wheel Python version cp310 Upload date Hashes View
Filename, size pyiced-0.3.0a6-cp39-cp39-musllinux_1_1_x86_64.whl (5.7 MB) File type Wheel Python version cp39 Upload date Hashes View
Filename, size pyiced-0.3.0a6-cp39-cp39-manylinux_2_24_x86_64.whl (5.1 MB) File type Wheel Python version cp39 Upload date Hashes View
Filename, size pyiced-0.3.0a6-cp39-cp39-manylinux_2_24_i686.whl (5.4 MB) File type Wheel Python version cp39 Upload date Hashes View
Filename, size pyiced-0.3.0a6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.1 MB) File type Wheel Python version cp39 Upload date Hashes View
Filename, size pyiced-0.3.0a6-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl (5.4 MB) File type Wheel Python version cp39 Upload date Hashes View
Filename, size pyiced-0.3.0a6-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (5.2 MB) File type Wheel Python version cp39 Upload date Hashes View
Filename, size pyiced-0.3.0a6-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.whl (5.4 MB) File type Wheel Python version cp39 Upload date Hashes View
Filename, size pyiced-0.3.0a6-cp38-cp38-musllinux_1_1_x86_64.whl (5.7 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size pyiced-0.3.0a6-cp38-cp38-manylinux_2_24_x86_64.whl (5.1 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size pyiced-0.3.0a6-cp38-cp38-manylinux_2_24_i686.whl (5.4 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size pyiced-0.3.0a6-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.1 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size pyiced-0.3.0a6-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl (5.4 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size pyiced-0.3.0a6-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (5.2 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size pyiced-0.3.0a6-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.whl (5.4 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size pyiced-0.3.0a6-cp37-cp37m-musllinux_1_1_x86_64.whl (5.7 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size pyiced-0.3.0a6-cp37-cp37m-manylinux_2_24_x86_64.whl (5.1 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size pyiced-0.3.0a6-cp37-cp37m-manylinux_2_24_i686.whl (5.4 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size pyiced-0.3.0a6-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.1 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size pyiced-0.3.0a6-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl (5.4 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size pyiced-0.3.0a6-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (5.2 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size pyiced-0.3.0a6-cp37-cp37m-manylinux_2_12_i686.manylinux2010_i686.whl (5.4 MB) File type Wheel Python version cp37 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page