From f965a6bc66414da2bf6aca05de94a9c99edffcfb Mon Sep 17 00:00:00 2001 From: manatlan Date: Fri, 1 Mar 2024 14:50:02 +0100 Subject: [PATCH] minor changes + docs --- docs/index.md | 4 ++-- htag/__main__.py | 4 ++++ main.py | 21 +++++++++++++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 main.py diff --git a/docs/index.md b/docs/index.md index 620dfdd..4be9ca9 100644 --- a/docs/index.md +++ b/docs/index.md @@ -5,7 +5,7 @@ ... Docs are coming (2024/03/1) ... ;-) Meanwhile, you can learn a lot on [htag's demo](https://htag.glitch.me/) ... or better [try/repl your self](https://raw.githack.com/manatlan/htag/main/examples/pyscript_demo.html) -(it's an htag app, running with the runner PyScript, in a simple html page, which provide examples in a html editor) ;-) +(it's an htag app, running with the runner PyScript, in a simple html page, which provide examples in an html editor) ;-) ## Quick start @@ -21,7 +21,7 @@ Create a starter app ;-) ```bash $ pyhon3 -m htag ``` -(it will create a "main.py" basic app) +(it will create a "main.py" basic htag app) Start the app : diff --git a/htag/__main__.py b/htag/__main__.py index 5531bf7..aec84b9 100644 --- a/htag/__main__.py +++ b/htag/__main__.py @@ -20,6 +20,10 @@ class App(Tag.body): def init(self): self += "Hello World" + self += Tag.button("Say hi", _onclick=self.sayhi) + + def sayhi(self,o): + self+="hi!" #================================================================================= from htag.runners import Runner diff --git a/main.py b/main.py new file mode 100644 index 0000000..d95d3e7 --- /dev/null +++ b/main.py @@ -0,0 +1,21 @@ + +# -*- coding: utf-8 -*- +# the simplest htag'app, in the best env to start development (hot reload/refresh) + +from htag import Tag + +class App(Tag.body): + statics="body {background:#EEE;}" + + def init(self): + self += "Hello World" + self += Tag.button("Say hi", _onclick=self.sayhi) + + def sayhi(self,o): + self+="hi!" + +#================================================================================= +from htag.runners import Runner + +if __name__=="__main__": + Runner(App).run()