Panel: Include the Panel Select widgets as Param widgets

Created on 13 May 2019  路  4Comments  路  Source: holoviz/panel

Apologies if there is already a way to do this, but I ran into a stumbling block when attempting to add a RadioBoxGroup widget as a Param input for an interactive plot.

Below is a toy example just to reflect my imagined RadioBoxGroup syntax

class Example(param.Parameterized):

    radio_group = param.RadioBoxGroup(default='Biology', objects=['Biology', 'Chemistry', 'Physics'], inline=False)

    @param.depends("radio_group")
    def view(self):
        return self.radio_group

example = Example()
pn.Column(example.param, example.view)

Most helpful comment

You can do this now:

class Example(param.Parameterized):

    radio_group = param.ObjectSelector(default='Biology', objects=['Biology', 'Chemistry', 'Physics'])

    @param.depends("radio_group")
    def view(self):
        return self.radio_group

example = Example()
pn.Row(pn.panel(example.param, widgets={'radio_group': pn.widgets.RadioBoxGroup}), example.view)

Let me know if you have a suggestion for making this clearer in the docs.

All 4 comments

You can do this now:

class Example(param.Parameterized):

    radio_group = param.ObjectSelector(default='Biology', objects=['Biology', 'Chemistry', 'Physics'])

    @param.depends("radio_group")
    def view(self):
        return self.radio_group

example = Example()
pn.Row(pn.panel(example.param, widgets={'radio_group': pn.widgets.RadioBoxGroup}), example.view)

Let me know if you have a suggestion for making this clearer in the docs.

Oh awesome, yep that did the trick. Thanks!

At the risk of cluttering the page I'd suggest adding this (or similar) example to the Parameters user guide

Ah, I actually thought that page already an example of this pattern, it should definitely be documented there.

Cool, thanks for your quick reply!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

philippjfr picture philippjfr  路  3Comments

MarcSkovMadsen picture MarcSkovMadsen  路  3Comments

maximlt picture maximlt  路  5Comments

henriqueribeiro picture henriqueribeiro  路  3Comments

joelostblom picture joelostblom  路  3Comments