2022-09-11 16:33:43 +02:00
|
|
|
|
|
|
|
from pyscript_bootstrap_templates import bootstrap_templates
|
|
|
|
from pyscript_bootstrap_templates import bootstrap_HTML as bHTML
|
|
|
|
from pyscript_bootstrap_templates import HTML as HTML
|
|
|
|
|
|
|
|
app = bootstrap_templates.PyScriptBootstrapDashboard(
|
|
|
|
parent_element="pyscript_app", brand_name="hello_world")
|
2022-09-13 19:18:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
div = bHTML.Div("This is a sidebar", parent=app.sidebar)
|
2022-09-11 16:33:43 +02:00
|
|
|
div.font_size = 4
|
|
|
|
|
|
|
|
btn = bHTML.ButtonPrimary("Click me", parent=app.sidebar)
|
|
|
|
btn.w = 100
|
2022-09-13 16:51:43 +02:00
|
|
|
|
2022-09-24 17:49:06 +02:00
|
|
|
toast_container = bHTML.ToastContainer(parent=app.main)
|
2022-09-13 19:18:24 +02:00
|
|
|
toast_container.position_bottom = 0
|
|
|
|
toast_container.position_end = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-09-13 16:51:43 +02:00
|
|
|
def onclick(_):
|
2023-06-04 18:51:06 +02:00
|
|
|
# NOTE: you can also use app.toast(...) and app.alert_success(...) to show toasts
|
|
|
|
# and alerts at the default bottom right position
|
2022-09-24 17:49:06 +02:00
|
|
|
alert = bHTML.AlertSuccess("You clicked me!", parent=app.main)
|
2022-09-13 19:18:24 +02:00
|
|
|
alert.w = 25
|
|
|
|
toast = bHTML.Toast("You clicked me!", parent=toast_container)
|
|
|
|
toast.animation = True
|
2022-09-13 16:51:43 +02:00
|
|
|
toast.show()
|
|
|
|
|
|
|
|
btn.onclick = onclick
|