A set of tools which simplify building cross-platform desktop apps with Python, JavaScript, HTML & CSS.
Project description
aiodesktop
A set of tools which simplify building cross-platform desktop apps with Python, JavaScript, HTML & CSS.
Features
In contrast to typical desktop GUI frameworks such as tkinter, wxPython, PyQt or Kivy:
- does not define own widgets/layout system (Kivy, Qt, wx), simply use a browser as a platform which already provides those things
- reuse time-saving libraries like React, Bootstrap or Highcharts
- reuse technologies like WebRTC, WebGL, WebAssembly
- access platform features such as cameras, geolocation and others
- your app is client-server and cross-platform by design, different devices may use it simultaneously
Compared to existing alternatives such as Eel, async-eel and guy:
- runs on asyncio instead of threads or gevent greenlets
- highly customizable aiohttp server
- no global state / singleton API
Install
Install from pypi with pip
:
pip install aiodesktop
Hello, World!
import aiodesktop
class Server(aiodesktop.Server):
async def on_startup(self):
aiodesktop.launch_chrome(self.start_url)
# Use `expose` decorator to mark method as visible from JS
@aiodesktop.expose
async def get_string(self):
# Use `await self.js.xxx()` to call JS functions from Python
return 'Hello, ' + await self.js.getWorld()
server = Server()
server.configure(
init_js_function='onConnect',
index_html='''<html><body><script>
async function onConnect(server) {
// Exposing JS function to python
server.expose({
async getWorld() {
return 'World!'
}
});
// Use `await server.py.xxx()` to call Python methods from JS
document.body.innerHTML += await server.py.get_string();
};
</script></body></html>''',
)
server.run()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aiodesktop-0.1.2.tar.gz
(14.7 kB
view hashes)
Built Distribution
aiodesktop-0.1.2-py3-none-any.whl
(16.1 kB
view hashes)
Close
Hashes for aiodesktop-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf67f6afd3affba96a5770a5ec1c495007a4df08b354e8f4a22058bbdff9ae79 |
|
MD5 | 1bbae15ff76e2c667ddb9a0da6582c13 |
|
BLAKE2b-256 | 7f4ece1dc0e8d6246c063eb1ef21733218c032f3c80a9f57fd22de9a29786e3a |