Template for getting a GUI and Python backend via Eel quickly up-and-running.
I often need to quickly spin up small scripts or applications to share with others that require a basic GUI. This is a bare-bones template that can easily be adapted for such use-cases.
This template uses the Eel library. To quickly get started:
# Set up virtual environment and install Eel
python3 -m venv env
source env/bin/activate
pip3 install eel
# Run the template
python3 app.py
- To send data from GUI (Javascript) and trigger a Python function, use the
send_data()
function inscript.js
. - To write to the onscreen log:
log("Log text here")
from Javascripteel.log('Log text here')
from Python
- To request data from GUI (Python), use the
get_inputs()
function:data = eel.get_inputs()