- Download bottle.py file here bottle.py on GitHub
- Create a python script example.py
- Put bottle.py in the same folder
- Copy paste the HelloWord example
from bottle import route, run, template @route('/hello/:name') def index(name='World'): return template('Hello {{name}}!', name=name) run(host='localhost', port=8080)
- Launch example.py
- Open your browser http://localhost:8080/hello/YourName
- Your done
Bottle can even work with an Apache server in front of it as a WSGI app.
Why use Tx, GTK or QT for your scripts ui when you can have a lightweight multiplatform web ui in 4 lines of code ?
No comments:
Post a Comment