panel.Tabs & updated widget values

Hello!

I am new to Panel and my UI experience was some sketchy TclTk 2 million years ago. Naturally, I am under a tight deadline to get my dashboard up and running… you all understand.

I am using the pane.widgets.Tabs to create a wizard that walks a user through entering criteria. Each tab of the Tabs allows the user to update/enter their preferences. Examples: one tab has a RadioBoxGroup of options which the user selects, another tab has contextual text fields for users to express themselves in a comma-delimited manner. I am trying to make the final/last tab show a summary of all 38 updated parameters they have entered, but the .values are always empty or whatever was the default selection.

IntInput.value is always 0, TextInput.value is always empty, and IntRangeSlider.value is always whatever the start/stop values.

Would some gracious, kind soul help me understand how to fix this?

1 Like

Hi, a way to achieve your goal is to make a param.parameterized class with all your widgets and create a function that will return the last pane. You’ll link this function to the values of your widgets then you instantiate your class and create your tabs putting the function without parenthesis in the last tab.

here is an example :

import panel as pn
import param 
pn.extension()

class Tabs_example(param.Parameterized):
    intinput = pn.widgets.IntInput(value=0)
    txtinput = pn.widgets.TextInput(value='a')
    intslide = pn.widgets.IntRangeSlider(start=0,end=10)
    
    @pn.depends('intinput.value','txtinput.value','intslide.value')
    def summary(self):
        return pn.pane.Markdown(f'int : {self.intinput.value} <br> txt : {self.txtinput.value} <br> slide start :{self.intslide.value[0]} <br> slide end : {self.intslide.value[1]}')

t=Tabs_example()

pn.Tabs(('int',t.intinput),('text',t.txtinput),('slider',t.intslide),('summary',t.summary))

Awesome, thank you. I will adapt it to my local situation and report back mostly likely over the weekend.