Given some class the obvious way to create a panel of parameters is the following:
class Something():
# Some Params
str1 = param.String('1')
str2 = param.String('2')
A = Something()
pn.Column(A.param).servable()
However, what if I want to control the layout of A.param? Or only show some of the parameters? Additionally, how could I set the “margin” and other properties of widgets for different parameters?
An Psuedo-code of what I want would be:
class Something(param.Parameterized):
# Some Params
str1 = param.String('1')
str2 = param.String('2')
pane1= pn.panel(str1,margin = (25,25,25,25))
pane2= pn.panel(str2,margin = (25,25,25,25))
row = pn.Row(pane1,pane2)
A = Something()
pn.Column(A.row).servable()
Thanks for your help again! I should have been slightly more explicit. I’d like this panel to exist within the class so that the user doesn’t have to configure the panel on each instance of the class.
Imagine hundreds of params, in this case it would be nice to “select” certain params to display in a subpanel. I.e. imagine customizing a hundred parameters every time the object is created and displayed. So this would be something sorta like the “row” in my pseudo code.
Very helpful! I’m still having a bit of trouble because it feels like the API has to be cross-referenced to the right example in the gallery. But I am starting to get the gist of it.
A follow up question. If this object were a DataFrame param object
I.e. the width =200 doesn’t seem to have any real effect causing the column to explode in width when it gets to the dataframe level. And what I really want is to use the pn.pane.DataFrame to display this parameter dataframe. ( The dataframe is for monitoring values that changes only due to interacting with the gui.)
Thanks for the help again. I’m struggling to come up with a simple example here. The key thing is that I want a dataframe parameter than can be updated internally in the class (just like in our previous/earlier examples). The problem with code like:
Allows me to both display and update the gui. However, the “width” argument is ignored.
If I tried to run
pn.pane.DataFrame(df)
I would get the error: ValueError: DataFrame pane does not support objects of type ‘Param’.
In other words, I need the object sent to the pn.pane.DataFrame to not just be an instance of the self.dataframe parameter but rather the “parameter” that updates.