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.

Find it on PyPi: https://pypi.org/project/xut/0.1.0/


📄 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_win-0.1.1.tar.gz (26.0 MB view details)

Uploaded Source

Built Distribution

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

xut_win-0.1.1-py3-none-any.whl (26.9 MB view details)

Uploaded Python 3

File details

Details for the file xut_win-0.1.1.tar.gz.

File metadata

  • Download URL: xut_win-0.1.1.tar.gz
  • Upload date:
  • Size: 26.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for xut_win-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a18ddd4c2bab1a670435c13f8569411298d389e45cdf9b7b57425f4077a6e3a5
MD5 a979d7f60acd690156dfea024161abed
BLAKE2b-256 c07a1c9a82263e6ee68e75ef06b67712cdac14fc02da3f144af6d84dc5244ab2

See more details on using hashes here.

File details

Details for the file xut_win-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: xut_win-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 26.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for xut_win-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e3a7cbfc36a54d792d4a991229e1a6e490c22e3ec65bb5f9d170a83b4a140558
MD5 d6e4e79a1874c619b50dcec653e4f414
BLAKE2b-256 3da411a67ae81d00708af7c8d65cf09bd9d3aea5f7451c8f3419cdb05e951fee

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