Skip to content

Examples Overview

These examples demonstrate Pytonium's capabilities, from basic windowing to full desktop applications. Each example is a standalone project you can clone and run.

Examples Repository

All example source code is available at github.com/Maximilian-Winter/pytonium_examples. Clone the repository to run any example locally.

git clone https://github.com/Maximilian-Winter/pytonium_examples.git
cd pytonium_examples

Example Description Key Features
Simple App Basic Python + HTML app with bindings, state, and context menus Custom schemes, @returns_value_to_javascript, state management
Frameless Window Custom window chrome with an HTML/CSS titlebar set_frameless_window, drag/resize regions, window control bindings
3D with Babylon.js 3D rendering using custom schemes and MIME types MIME type mapping, custom data schemes, .glb model loading
Real-Time Line Graph Live data visualization with Python state updates set_state in a loop, registerForStateUpdates, Canvas rendering
Control Center Dashboard-style app with multiple panels Multiple state namespaces, context menus, multi-panel layout
Data Studio Data analysis tool with interactive UI File loading from Python, @returns_value_to_javascript for queries

Running an Example

Each example follows the same structure:

example-name/
    main.py         # Python entry point
    index.html      # Main HTML page
    style.css       # Styles (optional)
    app.js          # JavaScript logic (optional)

To run any example:

cd example-name
python main.py

Prerequisites

Make sure Pytonium is installed before running examples:

pip install Pytonium

What to Learn from Each Example

Starting out? Begin with the Simple App. It covers all the fundamentals: custom schemes for local file loading, Python-to-JavaScript function bindings, and real-time state management.

Want custom window chrome? The Frameless Window example shows how to replace the native titlebar with an HTML/CSS design, including drag regions and window control buttons.

Working with 3D or binary assets? The Babylon.js example demonstrates MIME type mapping for non-standard file types and multiple custom schemes for different asset directories.

Need real-time data? The Line Graph example shows the pattern for pushing data from Python and rendering live updates in JavaScript.

Building something larger? The Control Center and Data Studio examples demonstrate multi-panel layouts, multiple state namespaces, and more advanced binding patterns.