Create a cross-platform, native, webview-based GUI using Rust and pure Python asyncio. #5774
AriBermeki
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
PyOrion
Hello everyone 👋
I’m posting this here because maybe you’re interested in trying it out or even contributing.
I’ve developed PyOrion – a framework that enables Python developers to build fully asynchronous, native, web-based GUIs.
The idea was born because existing solutions like pywebview, PySide/Qt, or wxWidgets always run into the same problem:
the GUI event loop blocks the Python main thread or makes asynchronous programming unnecessarily complicated.
So I took a different approach:
The GUI loop runs entirely in a separate Rust process, while communication with Python happens asynchronously via Unix Domain Sockets or Named Pipes.
This allows us to leverage the system’s native WebView engines – with no separate servers, no blocking, and true cross-platform support.
🚨 The Problem with Existing Solutions
pywebview
PySide / Qt
wxWidgets / Tkinter
Core Issue:
All these frameworks tightly couple the GUI loop to the Python main thread → blocking Python’s modern async world (
asyncio
, FastAPI, etc.).✅ My Approach: PyOrion
Multiprocessing with Rust
The GUI is built using pyo3 and the Tauri Toolkit, running in its own Rust process.
Each process has its own main thread → the event loop runs system-conformant, without blocking Python.
Native WebView Engine
→ No additional HTTP or WebSocket server required.
Asynchronous Communication
ipc_handler
→ more direct, higher performance, no script injection overhead.Cross-Platform Uniformity
macOS, Linux, Windows, Android, iOS → the same architecture everywhere:
Rust handles the GUI event loop, Python stays 100% async.
⚙️ Architecture Overview
Startup Phase
Python launches the Rust process and passes initial configuration (window, options, ports).
IPC Layer
Bidirectional communication between Python and Rust.
Deeply integrated with Rust’s GUI event loop.
Script Injection
At startup, Rust injects a small script into the WebView (JS) to provide the PyOrion API.
WebView Runtime
📚 API Reference
WindowBuilder
MethodsUsed to configure and initialize a window.
with_always_on_bottom()
with_always_on_top()
with_closable()
with_content_protection()
with_decorations()
with_focused()
with_fullscreen()
with_inner_size()
with_inner_size_constraints()
with_max_inner_size()
with_maximizable()
with_maximized()
with_min_inner_size()
with_minimizable()
with_position()
with_resizable()
with_theme()
with_title()
with_transparent()
with_visible()
with_visible_on_all_workspaces()
with_window_icon()
Window
MethodsRuntime operations for window instances (controllable via IPC).
available_monitors()
current_monitor()
cursor_position()
drag_resize_window()
drag_window()
fullscreen()
id()
inner_position()
inner_size()
is_closable()
is_decorated()
is_focused()
is_maximizable()
is_maximized()
is_minimizable()
is_minimized()
is_resizable()
is_visible()
monitor_from_point()
outer_position()
outer_size()
primary_monitor()
request_redraw()
request_user_attention()
scale_factor()
set_*()
methods (e.g.set_title
,set_resizable
,set_visible
, …)theme()
title()
WebViewBuilder
MethodsUsed to configure and initialize a WebView.
with_accept_first_mouse()
with_asynchronous_custom_protocol()
with_autoplay()
with_back_forward_navigation_gestures()
with_background_color()
with_bounds()
with_clipboard()
with_devtools()
with_document_title_changed_handler()
with_download_*_handler()
with_drag_drop_handler()
with_focused()
with_headers()
with_hotkeys_zoom()
with_html()
with_incognito()
with_initialization_script()
with_navigation_handler()
with_new_window_req_handler()
with_on_page_load_handler()
with_proxy_config()
with_transparent()
with_url()
with_user_agent()
with_visible()
with_web_context()
WebView
MethodsRuntime operations for WebViews.
bounds()
clear_all_browsing_data()
close_devtools()
evaluate_script()
focus()
is_devtools_open()
load_url()
open_devtools()
print()
set_background_color()
set_bounds()
set_visible()
url()
zoom()
Native Capabilities
Planned or partially implemented extensions:
clipboard
controlcenter
dialog
dirs
webview
window
os_info
tray-icon
global-hotkey
menu
🔗 Command System & JavaScript API
Inspired by Tauri:
window.invoke()
.Integration with Python Frameworks
PyOrion can be embedded into existing Python web frameworks, e.g.:
Example: JS → Python
🔑 Key Features
🤝 Community & Support
📜 Conclusion
While frameworks like pywebview, Qt, or wxWidgets block Python or add unnecessary overhead, PyOrion takes a new approach:
ipc_handler
instead of WebSocket)With PyOrion, it’s finally possible to build truly asynchronous, native, web-based GUIs in Python – lightweight, modern, and cross-platform.
Beta Was this translation helpful? Give feedback.
All reactions