Hi, I am building app where i have multiple tabs. Each of the tab contains few widgets. Within a tab, there is a base widget and there are other widgets whose value are function of the base widget.
So while working in Tab 2 (lets say), if i change the value of base widget I expect to see the dependent widgets getting changed accordingly. But as soon as i change the base widget, I am taken to Tab 1, although the widgets of Tab 2 are changed. I am getting the desired output in Tab 2 widgets but I don’t want to be taken to Tab 1 when I change something in Tab2
So is there a way that changing something in Tab 2 to trigger a function call in Tab 2 doesn’t take me to Tab 1?
Following is the code for easy understanding (also attaching image of the same):
widget_a = pn.widgets.TextInput(name=“a”, width=60, value=‘4’)
widget_b = pn.widgets.TextInput(name=“b”, width=60, value=‘7’)
def b_operation(b):
my_dict={}
x2=float(b)*6
y2=float(b)+7
my_dict.update({‘x2’:x2, ‘y2’:y2})
return my_dict
def get_sheet(variable):
sheet_widgets = pn.Column(widget_b,
pn.widgets.TextInput(name= “var3”, width = 60, value = str(variable[“x2”])),
pn.widgets.TextInput(name= “var4”, width = 60, value = str(variable[“y2”])))
return sheet_widgets
@pn.depends(widget_a.param.value, widget_b.param.value)
def show_tabs(widget_a_value, widget_b_value):
result = b_operation(widget_b_value)
sheet = get_sheet(result)
show = pn.Tabs((“Tab 1”, widget_a), (“Tab 2”, sheet))
return show
disp = pn.Column(show_tabs)
pn.serve(disp)