This is a presentation with some examples about how to use our HTML5 library to write fast, extensible and modular web-apps in Python!
html5.Widget corresponds to a DOM-widgethtml5.Widget() is super-class for all elementshtml5.Div(), html5.Li(), html5.Input()*widget["attribute"]Widget.hide(), Widget.disable(), Widget.addClass()(*) Always only uppercase first letter, rest is lowercase, therefore html5.Textarea()
```python class HelloWorldSayer(html5.Div): def init(): super().init("
def onMouseOver(self, event):
logging.info("You're over me!")
html5.Body().appendChild(HelloWorldSayer()) ```
Widget.prependChild() and Widget.insertChild() operate analogously
python
ul = html5.Ul()
ul.appendChild("<li>lol</li>")
ul.prependChild(html5.Li(1337 * 42))
ul.appendChild("<li>me too</li>", html5.Li("same as I"))
Widget.sinkEvent() sinks events to be recognizedhtml5.utils.doesEventHitWidgetOrChildren()event.stopPropagate() and event.preventDefault() to delegate event bubbling```python def Clicker(html5.Div): def init(): super().init("Hit me!") self.sinkEvent("onClick")
def onClick(self, event):
html5.ext.Alert("You clicked me!")
```
html5.fromHTML() calls generic HTML parser (returns widget list)Widget.fromHTML() calls Widget-bound HTML parser (returns widget list)html5.parseHTML() parses HTML for faster interpretation (returns HtmlAst)python
html5.Body.fromHTML("""<input [name]="input" class="ignt-input">""")
[name] binds associated name to binder, e.g. html5.Body().inputappendTo- and bindTo-arguments to change or disable appending and binding target**kwargs-arguments to pass in variable value replaced in attributes and plain text```python
html5.Body.fromHTML("""""", bindTo=self)
self.appendChild("
Widget.fromHTML()Any questions?