vdom 0.4
Write declarative layouts in Python, today! π
pip install vdom
Use positional arguments for children instead of arrays
You can now write:
div(
h1('Woohoo'),
p('it works')
)
Instead of:
div([
h1('Woohoo'),
p('it works')
])
keyword arguments should come after the positional arguments.
Now with more helpers!
All the standard DOM elements are importable from vdom.helpers
(#15)
from vdom.helpers import div, span, p, meter
def happiness(level=90):
smiley = "π"
percent = level / 100.
if(percent < 0.25):
smiley = "βΉοΈ"
elif(percent < 0.50):
smiley = "π"
elif(percent < 0.75):
smiley = "π"
return span(
p('Happiness ', smiley),
meter(level, min=0, low=25, high=75, optimum=90, max=100, value=level)
)
Documentation
We've started off some light documentation of how to use vdom
, and we would welcome more examples from you.
Under the hood
Basic tests are set up to ensure you can use vdom
in python2 and python3.