I have defined a custom Parameterized class the folowing way:

class Myclass(param.Parameterized):

    var1 = param.ObjectSelector(
        objects=['A', 'B', 'C'],
        default='B',
        label='Param1',
    )

    seg3 = param.ObjectSelector(
        objects={
            'First group': 'ZK',
            'Second one': 'ZL',
        },
        default='ZL',
        label='Groups',
    )

Whenever I want to instanciate this class and generate a Pane with widgets to select parameters, as per the documentation I use the following:

instance = Myclass()
pn.panel(instance.param)

This gives me the following output:

Panel with widget and title

I would like to know how I could get to modify the title that appears to default to the class name? Ideally, it would be at the pn.panel(...) level as I would like to have control on specific title, should I split these widgets in several panes.

See:

pn.Row(
    pn.panel(
        instance.param, 
        parameters=['var1']
    ),
    pn.panel(
        instance.param, 
        parameters=['seg3']
    )
)

which yields (and I would like to specify custom titles for each pane):

Panel split in two

1

There are 1 answers

1
Sander van den Oord On BEST ANSWER

You can change the name as follows:

instance = Myclass(name='Different Name')

This results in your case in the following:

panel pyviz app name changed

Please note that can also get parameters without using pn.panel() as follows:

pn.Row(
    instance.param.var1,
    instance.param.seg3,
)

You can do this for example if you don't want to see the name and just use something like pn.pane.HTML() to add a different title.