Sfoglia il codice sorgente

moved ui.open example to the other routing topics

Rodja Trappe 3 anni fa
parent
commit
55494c626f
1 ha cambiato i file con 10 aggiunte e 8 eliminazioni
  1. 10 8
      main.py

+ 10 - 8
main.py

@@ -395,6 +395,15 @@ with example(ui.page):
 
     ui.link('Visit other page', '/other_page')
 
+
+with example(ui.open):
+    with ui.page('/yet_another_page') as other:
+        ui.label('Welcome to yet another page')
+        ui.button('RETURN', on_click=lambda e: ui.open('/', e.socket))
+
+    ui.button('REDIRECT', on_click=lambda e: ui.open('/yet_another_page', e.socket))
+
+
 add_route = """### Route
 
 Add a new route by calling `ui.add_route` with a starlette route including a path and a function to be called.
@@ -447,11 +456,4 @@ with example(ui.keyboard):
     ui.label('Key events can be caught globally by using the keyboard element.')
     ui.checkbox('Track key events').bind_value_to(keyboard, 'active')
 
-with example(ui.open):
-    with ui.page('/yet_another_page') as other:
-        ui.label('Welcome to yet another page')
-        ui.button('RETURN', on_click=lambda e: ui.open('/', e.socket))
-
-    ui.button('REDIRECT', on_click=lambda e: ui.open('/yet_another_page', e.socket))
-
-ui.run(port=8080)
+ui.run()