Quickstart tutorial of htmlPy

Standalone application

Following code assumes that there is a file index.html in the same directory as the file and the script is being executed fromt the same directory.

import htmlPy
import os

app = htmlPy.AppGUI(title=u"htmlPy Quickstart", maximized=True)

app.template_path = os.path.abspath(".")
app.static_path = os.path.abspath(".")

app.template = ("index.html", {"username": "htmlPy_user"})


The above code instantiates an application, renders index.html file in that application using Jinja2 templating engine and starts it.

Web based application

Following code is a web-based application displaying Python website. You can change the URL to a local or network server to display any website as an application.

import htmlPy

web_app = htmlPy.WebAppGUI(title=u"Python Website", maximized=True)
web_app.url = u"http://python.org/"