Procházet zdrojové kódy

add wrapper column to page in order to apply flex layout with gaps to top-level elements

Falko Schindler před 4 roky
rodič
revize
2d844956f8
2 změnil soubory, kde provedl 8 přidání a 5 odebrání
  1. 0 1
      elements.py
  2. 8 4
      nice_gui.py

+ 0 - 1
elements.py

@@ -46,7 +46,6 @@ class Page(Group):
     def __init__(self):
     def __init__(self):
 
 
         self.view = jp.WebPage(delete_flag=False, body_classes='m-4', title='Nice GUI')
         self.view = jp.WebPage(delete_flag=False, body_classes='m-4', title='Nice GUI')
-        jp.justpy(lambda: self.view, start_server=False)
 
 
 
 
 class Column(Group):
 class Column(Group):

+ 8 - 4
nice_gui.py

@@ -1,10 +1,14 @@
 import justpy as jp
 import justpy as jp
-from elements import Page
+from elements import Column, Page
 
 
-main = Page()
+page = Page()
+content = Column(page.view)
+
+jp.justpy(lambda: page.view, start_server=False)
 ui = jp.app
 ui = jp.app
 
 
 # bind methods to simplify API -- justpy creates an app which must be found by uvicorn via string "module:attribute"
 # bind methods to simplify API -- justpy creates an app which must be found by uvicorn via string "module:attribute"
-for field in dir(main):
-    if field[0] != '_' and callable(attr := getattr(main, field)):
+for field in dir(content):
+    if field[0] != '_' and callable(attr := getattr(content, field)):
         setattr(ui, field, attr)
         setattr(ui, field, attr)
+ui.timer = page.timer