You are looking at an HTML rendering of the generated widgets, they are lacking responsiveness due to no Python kernel being available for callbacks.
Form from JSONSchemaΒΆ
Use a raw JSON Schema document to generate a form with validated defaults.
[1]:
from ipywidgets_jsonschema import Form
schema = {
"type": "object",
"properties": {
"experiment_id": {
"type": "string",
"pattern": "^EXP-[0-9]{4}$",
"default": "EXP-0001",
},
"replicates": {"type": "integer", "minimum": 1, "maximum": 10, "default": 3},
"mode": {"type": "string", "enum": ["fast", "accurate"], "default": "fast"},
"temperature_c": {
"type": "number",
"minimum": -20,
"maximum": 120,
"default": 22.5,
},
"send_report": {"type": "boolean", "default": False},
},
"required": ["experiment_id", "replicates", "mode", "temperature_c", "send_report"],
}
json_schema_form = Form(schema, use_sliders=True, show_descriptions=True)
json_schema_form.show()
[2]:
json_schema_form.data
[2]:
{'experiment_id': 'EXP-0001',
'replicates': 3,
'mode': 'fast',
'temperature_c': 22.5,
'send_report': False}