Skip to content

Commit 3c7c0c9

Browse files
committed
update theme demo
1 parent 057b227 commit 3c7c0c9

File tree

1 file changed

+25
-21
lines changed

1 file changed

+25
-21
lines changed

demos/theme.py

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,11 @@ def main(): # PyWebIO application function
192192
dict(label=i, value=i, color=i)
193193
for i in ['primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark']
194194
], onclick=lambda b: toast(f'Clicked {b} button'), outline=True)
195-
196-
put_buttons([
197-
dict(label=i, value=i, color=i)
198-
for i in ['primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark']
199-
], onclick=lambda b: toast(f'Clicked {b} button'), group=True)
195+
with put_scrollable(border=False, height=None):
196+
put_buttons([
197+
dict(label=i, value=i, color=i)
198+
for i in ['primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark']
199+
], onclick=lambda b: toast(f'Clicked {b} button'), group=True)
200200
###########################################################################################
201201
put_markdown('# Tables')
202202
put_markdown("""
@@ -258,13 +258,14 @@ def show_popup():
258258
put_markdown('# Loading')
259259
put_processbar('processbar', 0.3)
260260
put_text()
261-
put_grid([
262-
[
263-
put_loading(shape=shape, color=color)
264-
for color in ('primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark')
265-
]
266-
for shape in ('border', 'grow')
267-
], cell_width='50px', cell_height='50px')
261+
with put_scrollable(border=False, height=None):
262+
put_grid([
263+
[
264+
put_loading(shape=shape, color=color)
265+
for color in ('primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark')
266+
]
267+
for shape in ('border', 'grow')
268+
], cell_width='50px', cell_height='50px')
268269
###########################################################################################
269270
put_markdown('# Tabs')
270271

@@ -345,22 +346,25 @@ def page():
345346
</div>
346347
""")
347348

348-
put_markdown('# Switch Themes')
349-
put_table(
350-
[
351-
[
352-
put_image(f"https://cdn.jsdelivr.net/gh/wang0618/PyWebIO@dev/docs/assets/theme/{name}.png").onclick(
353-
partial(go_app, name=name, new_window=False))
354-
for name in ALL_THEME if name != theme],
355-
]
356-
)
349+
put_markdown('# Switch Theme')
350+
themes = [
351+
put_image(f"https://cdn.jsdelivr.net/gh/wang0618/PyWebIO@dev/docs/assets/theme/{name}.png").onclick(
352+
partial(go_app, name=name, new_window=False))
353+
for name in ALL_THEME if name != theme
354+
]
355+
if info.user_agent.is_mobile:
356+
put_table([themes[:2], themes[2:]])
357+
else:
358+
put_table([themes])
359+
357360
put_markdown("""
358361
### Credits
359362
360363
The dark theme is modified from ForEvolve's [bootstrap-dark](https://github.com/ForEvolve/bootstrap-dark).
361364
The sketchy, minty and yeti theme are from [bootswatch](https://bootswatch.com/4/).
362365
""", lstrip=True)
363366

367+
set_env(input_panel_min_height=100, input_panel_init_height=190)
364368
output_widgets()
365369
pin_widgets()
366370
form()

0 commit comments

Comments
 (0)