MCPcopy Index your code
hub / github.com/pywebio/PyWebIO / pin_widgets

Function pin_widgets

demos/theme.py:10–50  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8
9
10def pin_widgets():
11 put_markdown("# Pin widget")
12 options = [
13 {
14 "label": "Option one",
15 "value": 1,
16 "selected": True,
17 },
18 {
19 "label": "Option two",
20 "value": 2,
21 },
22 {
23 "label": "Disabled option",
24 "value": 3,
25 "disabled": True
26 }
27 ]
28 put_input('input', label='Text input', placeholder="Enter email",
29 help_text="We'll never share your email with anyone else.")
30 put_input('valid_input', label="Valid input", value="correct value")
31 put_input('invalid_input', label="Invalid input", value="wrong value")
32 put_textarea('textarea', label='Textarea', rows=3, maxlength=10, minlength=20, value=None,
33 placeholder='This is placeholder message', readonly=False)
34 put_textarea('code', label='Code area', rows=4, code={'mode': 'python'},
35 value='import pywebio\npywebio.output.put_text("hello world")')
36 put_select('select', options=options, label='Select')
37 put_select('select_multiple', options=options, label='Multiple select', multiple=True, value=None)
38 put_checkbox('checkbox', options=options, label='Checkbox', inline=False, value=None)
39 put_checkbox('checkbox_inline', options=options, label='Inline checkbox', inline=True, value=None)
40 put_radio('radio', options=options, label='Radio', inline=False, value=None)
41 put_radio('radio_inline', options=options, label='Inline radio', inline=True, value='B')
42 put_slider('slider', label='Slider')
43 put_actions('actions', buttons=[
44 {'label': 'Submit', 'value': '1'},
45 {'label': 'Warning', 'value': '2', 'color': 'warning'},
46 {'label': 'Danger', 'value': '3', 'color': 'danger'},
47 ], label='Actions')
48
49 pin_update('valid_input', valid_status=True, valid_feedback="Success! You've done it.")
50 pin_update('invalid_input', valid_status=False, invalid_feedback="Sorry, that username's taken. Try another?")
51
52
53def form():

Callers 1

pageFunction · 0.85

Calls 9

put_markdownFunction · 0.85
put_inputFunction · 0.85
put_textareaFunction · 0.85
put_selectFunction · 0.85
put_checkboxFunction · 0.85
put_radioFunction · 0.85
put_sliderFunction · 0.85
put_actionsFunction · 0.85
pin_updateFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…