|
@@ -11,7 +11,6 @@ from nicegui.elements.html import Html
|
|
from nicegui.elements.markdown import Markdown
|
|
from nicegui.elements.markdown import Markdown
|
|
from nicegui.events import KeyEventArguments
|
|
from nicegui.events import KeyEventArguments
|
|
from nicegui.globals import page_stack
|
|
from nicegui.globals import page_stack
|
|
-from random import random
|
|
|
|
|
|
|
|
# add docutils css to webpage
|
|
# add docutils css to webpage
|
|
page_stack[0].head_html += docutils.core.publish_parts('', writer_name='html')['stylesheet']
|
|
page_stack[0].head_html += docutils.core.publish_parts('', writer_name='html')['stylesheet']
|
|
@@ -95,6 +94,7 @@ with ui.row().classes('flex w-full'):
|
|
ui.label('Output:')
|
|
ui.label('Output:')
|
|
output = ui.label('').classes('text-bold')
|
|
output = ui.label('').classes('text-bold')
|
|
|
|
|
|
|
|
+
|
|
with example(ui.label):
|
|
with example(ui.label):
|
|
ui.label('some label')
|
|
ui.label('some label')
|
|
|
|
|
|
@@ -177,7 +177,7 @@ with example(ui.checkbox):
|
|
checkbox_state = ui.label('False')
|
|
checkbox_state = ui.label('False')
|
|
|
|
|
|
with example(ui.switch):
|
|
with example(ui.switch):
|
|
- ui.switch('switch me', on_change=lambda e: switch_state.set_text("ON" if e.value else "OFF"))
|
|
|
|
|
|
+ ui.switch('switch me', on_change=lambda e: switch_state.set_text('ON' if e.value else'OFF'))
|
|
with ui.row():
|
|
with ui.row():
|
|
ui.label('the switch is:')
|
|
ui.label('the switch is:')
|
|
switch_state = ui.label('OFF')
|
|
switch_state = ui.label('OFF')
|
|
@@ -263,8 +263,10 @@ with example(ui.scene):
|
|
scene.stl(teapot).scale(0.2).move(-3, 4)
|
|
scene.stl(teapot).scale(0.2).move(-3, 4)
|
|
|
|
|
|
with example(ui.chart):
|
|
with example(ui.chart):
|
|
|
|
+ from random import random
|
|
|
|
+
|
|
options = {
|
|
options = {
|
|
- 'title': {'text': ''},
|
|
|
|
|
|
+ 'title': False,
|
|
'chart': {'type': 'bar'},
|
|
'chart': {'type': 'bar'},
|
|
'xAxis': {'categories': ['A', 'B']},
|
|
'xAxis': {'categories': ['A', 'B']},
|
|
'series': [
|
|
'series': [
|
|
@@ -432,6 +434,7 @@ with example(ui.page):
|
|
|
|
|
|
ui.link('Visit other page', '/other_page')
|
|
ui.link('Visit other page', '/other_page')
|
|
|
|
|
|
|
|
+
|
|
with example(ui.open):
|
|
with example(ui.open):
|
|
with ui.page('/yet_another_page') as other:
|
|
with ui.page('/yet_another_page') as other:
|
|
ui.label('Welcome to yet another page')
|
|
ui.label('Welcome to yet another page')
|
|
@@ -439,6 +442,7 @@ with example(ui.open):
|
|
|
|
|
|
ui.button('REDIRECT', on_click=lambda e: ui.open('/yet_another_page', e.socket))
|
|
ui.button('REDIRECT', on_click=lambda e: ui.open('/yet_another_page', e.socket))
|
|
|
|
|
|
|
|
+
|
|
add_route = """### Route
|
|
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.
|
|
Add a new route by calling `ui.add_route` with a starlette route including a path and a function to be called.
|