ui.py 463 B

1234567891011121314151617
  1. import justpy as jp
  2. from starlette.applications import Starlette
  3. class Ui(Starlette):
  4. from elements.label import Label as label
  5. from elements.button import Button as button
  6. def __init__(self):
  7. # NOTE: we enhance our own ui object with all capabilities of jp.app
  8. self.__dict__.update(jp.app.__dict__)
  9. self.tasks = []
  10. @self.on_event('startup')
  11. def startup():
  12. [jp.run_task(t) for t in self.tasks]