PYTHON × WEB × NATIVE
Build with the web.
Drive it with Python.
Python bindings for Ultralight 2.x. Bring HTML, CSS, and JavaScript to the native desktop, with application logic written in Python.
HTML / CSS
Python / asyncio
One application
01 / THE TOOLKIT
A window. A bridge. Your application.
Interface, logic, and data working together.
Native windows, web UI ↗
AppCore handles system fonts, DPI, keyboard, mouse, and IME. Shape your interface with HTML and CSS.
Application · Window 02 / BRIDGETwo languages, shared objects ↗
Register Python functions and objects for direct JavaScript calls. Share live containers and turn async results into Promises.
API · JSValue · JSArray 03 / RENDEROffscreen rendering, your host ↗
Load pages, run scripts, and read pixels. Integrate with an existing GUI or export Pillow images and NumPy arrays.
Runtime · View · PixelBuffer02 / YOUR FIRST APPLICATION
Start with a few lines.
One window. A call across languages.
Register a Python function, attach the API to the window's View, then load the page. JavaScript calls functions directly from the namespace.
AppCore drives the window loop. Offscreen scripts can opt into ScriptDriver.auto().
from ultralight_py import API, Application
with API("app") as api, Application() as app:
@api.register
def hello(name):
return f"Hello, {name}!"
window = app.create_window(800, 520, title="Hello, ultralight-py")
api.attach(window.view)
window.view.load_html("""
<style>
body { background: #111315; color: #edb584;
font: 24px system-ui; padding: 48px; }
</style>
<h1 id="hello"></h1>
<script>
document.querySelector('#hello').textContent = app.hello('world');
</script>
""")
app.run()
03 / THE REFERENCE
Find the interface you need.
Runtime / ViewEngine lifecycle, page loading, and evaluation→
Application / WindowNative windows, layout, DPI, and application loops→
APIFunction registration, object exports, and restoration→
JSValue / PythonBindingCross-language handles, bindings, and revocation→
ScriptDriver / ScriptPageAsync loading, page waits, and script driving→
SessionIsolated browser storage and persistent sessions→
JSArray / JSObjectLive containers, references, and explicit snapshots→
PixelBuffer / RGBAImagePixel capture, Pillow, and NumPy output→
04 / BUILT WITH ULTRALIGHT-PY
See it all come together.
From bridge experiments to desktop games: see native recordings, implementation ideas, and source code.
Bridge Lab ↗
An editable lab for functions, Promises, live objects, and containers.
CANVAS / GAMEEmberkeep ↗
A pixel dungeon with Python game rules and a Canvas interface.
MUSIC / VISUALIZATIONPianoScope ↗
Sheet music, falling notes, and real piano sound in one application.
VUE / INVENTORYAshen Reliquary ↗
Python manages inventory and equipment rules; Vue presents the UI.