()
| 8 | |
| 9 | |
| 10 | def 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 | |
| 53 | def form(): |
no test coverage detected
searching dependent graphs…