Skip to main content

Modern UI, out of the box.

Project description

XUT — Simple. Powerful. Instant UI.

XUT is a modern UI toolkit designed to feel effortless for beginners while staying insanely powerful for advanced users. It combines the simplicity of immediate-mode APIs with the performance and flexibility of retained-mode systems under the hood.


✨ Philosophy

  • Beginner-friendly, zero friction
  • Powerful and scalable
  • Immediate-mode on the surface
  • Retained-mode internally

🚀 Getting Started

Installation

pip install xut

Basic Setup

import xut

app = xut.App(theme="applesauce-mono")

🎨 Themes

Resolution Order

XUT automatically resolves themes in this order:

  1. ./applesauce-mono.xut
  2. ./applesauce-mono/applesauce-mono.xut
  3. Installed themes
  4. Default fallback

Theme Structure

applesauce-mono/
  applesauce-mono.xut
  fonts/
    Inter.ttf

Features

  • Hex colors
  • Variables
  • Global values
  • Font loading
  • Brightness modifiers
  • Hot-reload support 🔥

🔁 Main Loop

while app.running:
    app.begin_frame()
    # UI here
    app.end_frame()

Stop the app anytime:

app.stop()

🧠 Core Concepts

All UI elements share a unified API:

  • id (unique identifier)
  • pos=(x, y)
  • size=(w, h) (if applicable)
  • z (layer depth)
  • rotation (degrees)
  • font_size

Most elements return a handle, allowing real-time updates — even after creation.


🧩 UI Elements

🖼 Image

img = app.image("logo", path="assets/logo.png", pos=(100, 100), size=(128, 128))
img.rotation = 45

🔘 Button

if app.button_clicked("btn", "Click Me", pos=(100, 100), size=(120, 40)):
    print("clicked")

🧷 Icon Button

app.icon_button_clicked("save", "icons/save.png", pos=(50, 50), size=(40, 40))

Layouts:

  • icon_only
  • text_right
  • text_below

🏷 Label

app.label("Hello", pos=(100, 100))

Mutable label:

lbl = app.label_ex("status", "Ready", pos=(100, 100))
lbl.text = "Done!"

🧾 Input

text = app.input("username", pos=(100, 200), size=(300, 40))

🎚 Slider

value = app.slider("volume", pos=(100, 300), size=(300, 16))

☑ Checkbox / Toggle

app.checkbox("enable", "Enable", pos=(100, 350))
app.toggle("power", pos=(100, 400))

📊 Progress

app.progress(0.7, pos=(100, 500), size=(300, 10))

📂 Dropdown

app.dropdown("role", ["User", "Admin"], pos=(100, 550), size=(300, 40))

🧱 Layout Components

  • panel()
  • window()
  • tabs()
  • scrollbar()
  • divider()

⚙️ Element Handles (🔥 Powerful)

Every element can be modified live:

btn = app.button_clicked("ok", "OK", pos=(100, 100), size=(80, 32))

handle = app.get("ok")
handle.pos = (200, 300)
handle.text = "Confirm"
handle.rotation = 15

Properties

Property Description
pos Position
size Size
z Layer
text Label text
value Numeric value
rotation Rotation
font_size Font override
clicked Clicked this frame
hovered Mouse over
pressed Mouse held

🧠 Internal Behavior

Persistence

  • Elements are cached by id
  • Automatically reused every frame

Rendering

  • Sorted by z
  • Proper hitboxes (even rotated)

Events

  • Top layer gets priority
  • Stops propagation on interaction

🎨 Theme Control

Change Theme

app.set_theme("dark-pro")

Hot Reload

app.reload_theme()

Perfect for live editing your .xut files.


🪟 Window Control

app.set_window_title("My App")
app.set_window_icon("assets/icon.png")

⌨️ Shortcuts

if app.shortcut("ctrl+s"):
    save()

Supports:

  • ctrl, shift, alt, cmd
  • Letters, numbers
  • Function keys
  • Arrow keys

⚡ Example

import xut

app = xut.App("applesauce-mono", title="Settings")

while app.running:
    app.begin_frame()

    active = app.tabs("tabs", ["General", "Audio"], pos=(100, 100), size=(300, 30))

    if app.button_clicked("save", "Save", pos=(100, 200), size=(120, 40)):
        app.set_window_title("Saved!")

    if app.shortcut("ctrl+s"):
        print("Saved via shortcut")

    app.end_frame()

💡 Why XUT?

  • No boilerplate
  • No layout headaches
  • Real-time mutation
  • Hot-reload themes
  • Works great for tools, apps, and even full desktop environments 👀

🧪 Status

XUT is actively evolving. Expect rapid improvements, new elements, and deeper customization.


🧡 Contributing

Ideas, feedback, and contributions are welcome.


📄 License

MIT


Build fast. Iterate faster. Ship instantly.

Project details


Download files

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

Source Distribution

xut-0.1.0.tar.gz (28.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xut-0.1.0-py3-none-any.whl (29.6 MB view details)

Uploaded Python 3

File details

Details for the file xut-0.1.0.tar.gz.

File metadata

  • Download URL: xut-0.1.0.tar.gz
  • Upload date:
  • Size: 28.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for xut-0.1.0.tar.gz
Algorithm Hash digest
SHA256 453912039bf184cac1b7076d369948732073073a5887872061df65684a79d527
MD5 a8b36f4dbe20dc09778c829a04ae1e52
BLAKE2b-256 5c825b5fedb474c3651a43b8e5144d141a9df8570f83d0418247d4b0455f5e21

See more details on using hashes here.

File details

Details for the file xut-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: xut-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 29.6 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for xut-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6230cf238e2845e035d564dd07e82995e0514f7ef4431b037f5038f55103083c
MD5 aea0ffa814dbae6b0c6a812c98010573
BLAKE2b-256 fda59d43710e34ff01cc137194e922111131d62857f5b48d4579b1a15cfe3132

See more details on using hashes here.

Supported by

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