WebKivy
youtube link : https://www.youtube.com/watch?v=Ng7Pyy2f_kk
WebKivy is a minimalist wrapper that allows you to run Kivy/KivyMD applications directly in a browser using Pyodide.
⸻
Summary
- Why?
- How it works
- Quick Start
- Repository Structure
- Compatibility and Limitations
- Roadmap
- Contribute
- License
⸻
Why?
• No installation: Your Kivy app becomes a simple HTML + JS bundle.
• Instant demo: Share a link or a .zip file, and the public can test it immediately.
• Learning: Ideal for workshops or MOOCs where learners only have a browser at their disposal.
⸻
How it works
- Pyodide is loaded client-side (via a CDN).
- The connector.py file reconstructs a subset of Kivy.
• Base widgets: Label, Button, Slider, TextInput, ScreenManager, etc.
• Lightweight KivyMD overlay: MDToolbar, MDRaisedButton, MDCard, etc.
• HTML5 Canvas () for 2D rendering. - Your code imports these classes as if it were running the real library:
from connector import BoxLayout, Label, Slider - The JavaScript rendering loop calls the widgets' draw() method each frame, handles events (on_touch_down, keyboard, resize, etc.), and notifies the bindings (widget.bind(...)).
⸻
git clone https://github.com/youraccount/WebKivy.git
cd webkivy/WASM_kivy_connector
#or
cd WebKivy/WASM_kivy_connector
# launches a small server – required for ECMAScript (Javascript's modules) + Pyodide imports
python3 -m http.server 8000
Open http://localhost:8000 then select/edit kivy_app.py to code your interface.
from connector import Button, BoxLayout, run_kivy_app
class HelloApp: # MDApp / App : no necessary
def build(self):
root = BoxLayout(orientation='vertical', size=(500,300))
root.add_widget(Button(text="Click ?", on_press=lambda: print("Hello World !")))
return root</br>
if __name__ == '__main__':
run_kivy_app(__name__, 'HelloApp')
Save, refresh → your app is running in the browser!
⸻
File / folder Role
index.html Home page, loads main.js and prepares the
main.js Initializes Pyodide, loads connector.py then kivy_app.py
connector.py Kivy wrapper: stub widgets, layout, canvas, bindings, etc.
kivy_app.py Your application; you're free to create several
examples/ Recipes, KivyMD mini-demos, sliders, popups, ScreenManager, etc.
assets/ Icons, test images, etc. (loaded via Image(source=...))
⸻
Feature Support Notes
Basic Kivy Widgets ✓ Partial Position/Size: simplified x, y, size, size_hint
Canvas (Line, Ellipse, etc.) ✓ Minimal Solid colors, no advanced transformations
KivyMD ✓ Light Buttons, Toolbar, Card, Dialog, Checkbox, Slider, etc.
Animations / Clock ✕ Not implemented (to be planned)
Files / Storage ✕ No disk access: use localStorage, IPFS, etc.
Multitouch / Gestures ✕ Mouse/single touch support only
OpenGL / Shaders ✕ Incompatible with WebAssembly + Canvas2D
⸻
• Clock.schedule_once / Animation support
• Complex Widgets (Tab, RecycleView)
• Automatic dark/light theme
• WebSockets bridge to communicate with real Python backends
• Offline generator (Pyodide bundle + app in a self-contained .html)
⸻
- Fork then git clone.
- Create a branch: git checkout -b feat/my-feature.
- Code; feel free to add an example in examples/.
- Open a Pull Request
Thanks!
Bugs? Open an Issue with a minimal, reproducible script + console capture.