Pythonized bindings for microui.
Project description
Python Micro GUI
A quick gui for scripts that dont care about asthetics.
Installation
pip install microgui
or
uv add microgui
System Prerequisites
Because microgui compiles a native C extension (bridge.c) during installation, your system needs a C compiler and development headers:
Linux (Ubuntu/Debian):
sudo apt-get install build-essential libx11-dev
Windows: Install Visual Studio Build Tools and check the "Desktop development with C++" workload.
macOS: Currently Unsupported
Quick Start
Even though you install microgui, you import the library as mui in your code for simplicity. Here is how to spin up a basic window loop:
import mui.ui as ui
win = ui.Window(title="Micro GUI Window", width=500, height=500)
# will evaluate to True as long as the window is open
while win:
# actually manages the window and needs to run in loop
with win:
ui.label("Hello Micro GUI")
microgui vs Tkinter (Multi-Window Comparison)
When building multi-window applications, traditional frameworks like Python's built-in tkinter require complex object-oriented inheritance, tracking window lifecycle instances manually, and writing messy event callbacks.
Because microgui uses an immediate-mode pipeline, creating and managing multiple windows is entirely sequential, flat, and stateless.
The Tkinter Approach (Retained-Mode Architecture)
To manage two windows in Tkinter cleanly, you have to track parent-child tracking states and pass window instances through classes:
import tkinter as tk
class ControlWindow:
def __init__(self, root):
self.root = root
self.root.title("Control Panel")
# Really complicated stuff
self.display_win = tk.Toplevel(root)
self.display_win.title("Display Panel")
self.label = tk.Label(self.display_win, text="Status: Idle")
self.label.pack()
self.btn = tk.Button(root, text="Trigger", command=self.update_status)
self.btn.pack()
def update_status(self):
# Callbacks to update state
self.label.config(text="Status: Active!")
root = tk.Tk()
app = ControlWindow(root)
root.mainloop()
The MicroGUI Approach (Immediate-Mode Architecture)
In microgui, windows are just IDs. You switch drawing contexts on the fly inside a single, readable loop. No classes, no callbacks, and no state synchronization bugs:
import mui.ui as ui
app = ui.Application()
win_control = app.create_window("Control Panel", 400, 300)
win_display = app.create_window("Display Panel", 400, 300)
status_text = "Status: Idle"
while app:
# draw into the control window
with win_control:
if ui.button("Trigger"):
status_text = "Status: Active!" # global variable available to all windows
# draw into the display window
with win_display:
ui.label(status_text)
Why choose one over the other?
| Micro GUI | Traditional Frameworks(PyQT/PySide, Tkinter or Kivy) | |
|---|---|---|
| Use Case | Quick GUI for debugging or developer focused tools | Retained GUI with complex state and customization |
| Structure | Simple loops, conditionals and context managers. | OOP, classes and state. |
| Styling | It looks the way it looks. Focus on functionality | Complex styling with configuration and complex layout systems |
| Functionality | Conditionals manage everything, no complexity involved. | Events, Callbacks and sometimes Threads |
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
File details
Details for the file microgui-0.1.1.tar.gz.
File metadata
- Download URL: microgui-0.1.1.tar.gz
- Upload date:
- Size: 29.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
584affd16f6000769d1b9452a8210cc06f5821544caf4a9fa1618c1c27829bab
|
|
| MD5 |
f7da4f7645fa17a38cfb7a4b858c0f96
|
|
| BLAKE2b-256 |
e132f41a8e26bc50103fb201eb97887032127cde4b27db2b921352efe38ce34c
|
Provenance
The following attestation bundles were made for microgui-0.1.1.tar.gz:
Publisher:
python-publish.yml on harsha7addanki/python-microui
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
microgui-0.1.1.tar.gz -
Subject digest:
584affd16f6000769d1b9452a8210cc06f5821544caf4a9fa1618c1c27829bab - Sigstore transparency entry: 1904694964
- Sigstore integration time:
-
Permalink:
harsha7addanki/python-microui@53fe88757a1e6b807b61a87d66f4b9e74b9a3d80 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/harsha7addanki
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@53fe88757a1e6b807b61a87d66f4b9e74b9a3d80 -
Trigger Event:
release
-
Statement type: