This is my first time posting. I’m trying to build a web app that will take user input from a number of widgets and will then create an SVG based on the inputs. The code when presenting all of the widgets works great. However, I want to present a subset of questions to users based on whether things apply to them. I’ve set it up to use a toggle to let users select which things apply to them, and would like to show the appropriate widgets based on their selection.
My larger application includes a parameterized class, but I can’t get this simplified version to work and I’ve hit the edge of my current ability to troubleshoot. I’ve tried… a lot of things, and nothing has worked.
import panel as pn tplt = pn.template.FastListTemplate( title='Community Mosaic', header_background="#143250", theme_toggle=False, main_max_width='1200px', accent_base_color="#1DC2BB") tplt.main.append('Intro text') name_input = pn.widgets.TextInput(name='My name is:') toggle = pn.widgets.ToggleGroup(options=['I am a consultant','I have an internal role'] ) client_input = pn.widgets.RadioBoxGroup(name='My client work is in: ', options=['SEA','DAL', 'CHI', 'SF'], inline=True) hybrid_role_input = pn.widgets.RadioBoxGroup(name='I serve in: ', options=['Capability Leadership', 'Account Leadership', 'Industry Leadership'], inline=True) internal_func_input = pn.widgets.Select(name='My main function (internal) is: ', options=['People Team','Finance','Sales']) all_ppl_inputs = pn.Column(name_input, toggle) consult_only_inputs = pn.Column(client_input) hybrid_inputs = pn.Column(client_input, hybrid_role_input) internal_inputs = pn.Column(internal_func_input) tplt.main.append(all_ppl_inputs) role_inputs = pn.Column() def callback(event): print(event) if event.new == ["I'm consulting"]: role_inputs.object = consult_only_inputs watcher = toggle.param.watch(callback, ['value'], onlychanged=False) tplt.show()