Skip to content

Instantly share code, notes, and snippets.

@amcgregor
Forked from spinningcat/streamlit.py
Last active November 13, 2023 15:38
Show Gist options
  • Save amcgregor/4a622ec32d1fed5c3bccb986f75b4549 to your computer and use it in GitHub Desktop.
Save amcgregor/4a622ec32d1fed5c3bccb986f75b4549 to your computer and use it in GitHub Desktop.
Reference https://github.com/amcgregor/python-samples/blob/main/Metaprogramming/Alternate%20Class%20Instantiation.ipynb "the punchline" and "making it importable" sections for what `html.tag` is.
from html import tag as H
def app(environ, start_response):
start_response('200 OK', [])
page = H.html [
H.title("Transvoice App"), # I use double quotes for human text, single for machine.
H.style("…"),
H.article(data_layout='twin') [
H.header [ H.h3 [ "Main Language" ] ],
H.textarea('Main Language', rows=6, maxlength=5000), # actual attribute name, not max_chars
]
]
return [str(page)]
# yield from page # isn't implemented yet, but.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment