Skip to main content

Duit is a toolkit to create simple user-interfaces for python.

Project description

Duit (Data UI Toolkit) PyPI

Duit is a toolkit to create simple user-interfaces for python. It is based on the ideas of cansik/bildspur-base and cansik/bildspur-ui.

python_1xlGn4l6Pb

Example UI rendered with Open3D

Installation

To install duit with all dependencies call pip like this:

pip install "duit[all]"

It is also possible to only install certain packages (for example only Open3D):

pip install "duit[open3d]"

Example

To create a gui by code, create a new class with the data-fields you need.

from examples.Color import Color
from duit.model.DataField import DataField
import duit.ui as ui

class Config:
    def __init__(self):
        self.hungry = DataField(True) | ui.Boolean("Hungry")
        self.year = DataField(2021) | ui.Number("Year", 2000, 2050)
        self.temperature = DataField(30.2) | ui.Slider("Temperature", 0, 40)
        self.resolution = DataField(256) | ui.Options("Resolution", [64, 128, 256, 512, 1024])
        self.color = DataField(Color.White) | ui.Enum("Color")
        self.name = DataField("Test") | ui.Text("Name", readonly=True)

And use the open3d gui package to display them:

init_open3d_registry()

config = Config()
config.age.value = 10

app = o3d.visualization.gui.Application.instance
app.initialize()

win = DemoWindow(config)

app.run()

Settings

To save and load settings have a look at the following example. Serialization from and to json is automatically handled by duit.

config = Config()
settings = Settings()

settings.save("test.json", config)
settings.load("test.json", config)

Development

To develop it is recommended to clone this repository and install the dependencies like this:

# in the duit directory
pip install -e ".[all]"

About

MIT License - Copyright (c) 2022 Florian Bruggisser

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

duit-0.1.3.1-py3-none-any.whl (35.4 kB view details)

Uploaded Python 3

File details

Details for the file duit-0.1.3.1-py3-none-any.whl.

File metadata

  • Download URL: duit-0.1.3.1-py3-none-any.whl
  • Upload date:
  • Size: 35.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for duit-0.1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 612579a497eea85bb03140012296c5d7c7e19df6ec4328bd6029f3616b485af0
MD5 ed531a99cbe0d13195b4d0c1f88067db
BLAKE2b-256 21b4a3357d881985abed9daeb650855bbd64f6840c7b5d60ff32b5e5245fca34

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page