Setting visible to false on a param object

Hi,
I want to disable a visual based on its param definition as is shown in the example below.

import panel as pn
import param
pn.extension("bokeh")
class SimpleExample(param.Parameterized):
    update_plot = param.Action(label="UPDATE PLOT", doc="Update the plot")
    
    def __init__(self, **params):
        super().__init__(**params)
        self.update_plot = self._update_plot
        self.button = pn.Param(
                self.param.update_plot,
                widgets={"update_plot": {"button_type": "primary"}},
            )
        self.panels = [
            self.button]
        self.button.visible=False
        self.main = pn.Column(*self.panels)
        
    def _update_plot(self, *_):
        time.sleep(3)
app = SimpleExample(name="simple")
app.main.servable()

I think the code is working properly, but I cannot find the attribute that allows me to set visible to false since I am currently setting it to the param object.
Any idea what I am doing wrong ?

Okay, a three second search in the discourse told me that I need to use layout, I am sorry :expressionless:

Can you post the link to the other issue? Then people can avoid the three-second search if they hit the post first. :upside_down_face:

Sure. Here is one of the original issue

1 Like