pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/ZeroIntensity/view.py

GitHub - ZeroIntensity/view.py: The Batteries-Detachable Web Framework
Skip to content

The Batteries-Detachable Web Framework

License

Notifications You must be signed in to change notification settings

ZeroIntensity/view.py

Repository files navigation

view.py logo

The Batteries-Detachable Web Framework

This is a work-in-progress!

Installation

It's highly recommended to install from source at the moment:

$ pip install git+https://github.com/zerointensity/view.py

Examples

Simple Hello World

from view.core.app import App

from view.dom.core import html_response
from view.dom.components import page
from view.dom.primitives import h1

app = App()


@app.get("/")
@html_response
async def home():
    with page("Hello, view.py!"):
        yield h1("Nobody expects the Spanish Inquisition")


app.run()

Button Counter

from view.core.app import App
from view.dom.core import HTMLNode, html_response
from view.dom.components import page
from view.dom.primitives import button, p

from view.javascript import javascript_compiler, as_javascript_expression

app = App()


@javascript_compiler
def click_button(counter: HTMLNode):
    yield f"let node = {as_javascript_expression(counter)};"
    yield f"let currentNumber = parseInt(node.innerHTML);"
    yield f"node.innerHTML = ++currentNumber;"


@app.get("/")
@html_response
async def home():
    with page("Counter"):
        count = p("0")
        yield count
        yield button("Click me!", onclick=click_button(count))


app.run()

Copyright

view.py is distributed under the terms of the MIT license.

About

The Batteries-Detachable Web Framework

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Contributors 12

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy