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

Function form

demos/theme.py:53–104  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

51
52
53def form():
54 options = [
55 {
56 "label": "Option one",
57 "value": 1,
58 "selected": True,
59 },
60 {
61 "label": "Option two",
62 "value": 2,
63 },
64 {
65 "label": "Disabled option",
66 "value": 3,
67 "disabled": True
68 }
69 ]
70
71 input_group('Input group', [
72 input('Text', type=TEXT, datalist=['candidate-%s' % i for i in range(10)], name='text', required=True,
73 help_text='Required'),
74 input('Number', type=NUMBER, value="42", name='number'),
75 input('Float', type=FLOAT, name='float'),
76 input('Password', type=PASSWORD, name='password'),
77
78 textarea('Textarea', rows=3, maxlength=20, name='textarea',
79 placeholder="The maximum number of characters you can input is 20"),
80
81 textarea('Code', name='code', code={'mode': 'python'},
82 value='import pywebio\npywebio.output.put_text("hello world")'),
83
84 select('Multiple select', options, name='select-multiple', multiple=True),
85
86 select('Select', options, name='select'),
87
88 checkbox('Inline checkbox', options, inline=True, name='checkbox-inline'),
89
90 checkbox('Checkbox', options, name='checkbox'),
91
92 radio('Inline radio', options, inline=True, name='radio-inline'),
93
94 radio('Radio', options, inline=False, name='radio'),
95
96 file_upload('File upload', name='file_upload', max_size='10m'),
97
98 actions('Actions', [
99 {'label': 'Submit', 'value': 'submit'},
100 {'label': 'Disabled', 'disabled': True},
101 {'label': 'Reset', 'type': 'reset', 'color': 'warning'},
102 {'label': 'Cancel', 'type': 'cancel', 'color': 'danger'},
103 ], name='actions'),
104 ])
105
106
107def output_widgets():

Callers 1

pageFunction · 0.85

Calls 8

input_groupFunction · 0.85
inputFunction · 0.85
textareaFunction · 0.85
selectFunction · 0.85
checkboxFunction · 0.85
radioFunction · 0.85
file_uploadFunction · 0.85
actionsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…