A Python-first — Declarative-Mode — Backend-Agnostic — UI Library
Project description
What is CoshUI?
CoshUI is a Python-first, declarative UI library inspired by CSS, Godot, and Dear ImGui. Unlike most Python UI libraries, CoshUI is fully backend-agnostic — write your UI once and render it with Pygame, Raylib, or any backend you build yourself.
CoshUI features a full layout engine with flexbox-inspired sizing, a retained-state system, a tween animation system, a signal-based event model, and a theme system — all behind a clean, web-like API that's simple to pick up without sacrificing flexibility.
How to Install
pip install coshui
CoshUI is backend-agnostic — install with your renderer of choice:
# Pygame
pip install coshui[pygame]
# Raylib
pip install coshui[raylib]
# Both
pip install coshui[all]
How to Use
CoshUI uses Python's context managers to define UI hierarchy through indentation — familiar if you've worked with HTML or CSS:
import coshui as cui
# Within your loop
with cui.CoshUIRenderer(...):
with cui.Container(id="main_container", width=cui.FILL, height=cui.FILL, direction=cui.COLUMN, align=cui.ALIGN_CENTER, justify=cui.JUSTIFY_CENTER, gap=20):
cui.Label(id="menu_label", text="CoshUI", width=200, height=50, font_size=64)
cui.Button(id="print_btn", text="Print Hello World!", width=210)
cui.Button(id="color_btn", text="Change Color!", width=210)
# Listen for signals
if cui.get_signal("print_btn", cui.CLICKED):
print("Hello World!")
# Animate with one line
if cui.get_signal("color_btn", cui.CLICKED):
cui.animate("background_color", "main_container", (200, 200, 200), 1.5, "ease_in_out")
To learn more, check out the examples or visit the documentation.
Contributing
CoshUI is primarily developed on GitLab. Please open issues and pull requests there.
To learn more about how to contribute, check the contributing markdown.
Author
Main Developer and Maintainer: Jyle Frazier (Terra) Villareal
Contact
- GitLab: JyleFV
- GitHub: JyleFV
- X/Twitter: @JyleFV
- Discord: CoshUI
- Email: jylefraziervillareal@gmail.com
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file coshui-0.2.4.tar.gz.
File metadata
- Download URL: coshui-0.2.4.tar.gz
- Upload date:
- Size: 333.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e06d3730194159e3f9f32f515abdc638270f3debe08499dae1c375709c0eccb
|
|
| MD5 |
ba764c3aa4a5239047110ffdae8cd9d6
|
|
| BLAKE2b-256 |
9f83563039b3accab40216f636844a253a73df1a387fd470c140ca96ab118444
|
File details
Details for the file coshui-0.2.4-py3-none-any.whl.
File metadata
- Download URL: coshui-0.2.4-py3-none-any.whl
- Upload date:
- Size: 336.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1100c7cecccf8f3746b187c5dade51ca8a5a1023cc67f44cfc71692ab408864f
|
|
| MD5 |
6335f540dacf699d8b256fb35862afd9
|
|
| BLAKE2b-256 |
0c880dc83791054e883478fb2a49ba5a4d9c9540b35ead199ad31c6e7ba3160e
|