I just updated panel to the newest version and have been running into a few issues to get my code updated in parallel. When I try to set the maximum height for a pn.widgets.CheckBoxGroup or the header color for a pn.Card exactly as I had them before, the methods no longer work. Has anyone experienced this with the new update? I am assuming we may have to try passing them in with styles or something, but when I tried that, it did not work as well.
pn.widgets.CheckBoxGroup:
cognitive_symptoms_choice_pm = pn.widgets.CheckBoxGroup.from_param(
self.param["cognitive_symptoms_choice"],
sizing_mode = "stretch_both",
stylesheets = [input_group], margin = 0, max_height = 50)
emotional_symptoms_choice_pm = pn.widgets.CheckBoxGroup.from_param(
self.param["emotional_symptoms_choice"],
sizing_mode = "stretch_both",
stylesheets = [input_group], margin = 0, styles = {'max_height': '25'})
input_group = """
.bk-input-group {
font-size: 18px;
}
pn.Card:
pn.Card(pn.Row(pn.Column(pn.Column("## Cognitive Symptoms", cognitive_symptoms_choice_pm,
sizing_mode = "stretch_height", max_height = 150),
pn.Column("## Emotional Symptoms", emotional_symptoms_choice_pm,
sizing_mode = "stretch_height", max_height = 75),
title = "Please Select All Symptoms That Are Applicable",
collapsible = False, sizing_mode = "stretch_both",
header_background = "#154c79", header_color = "white",
stylesheets = [card_header])
card_header = """
.card-header {
color: white;
}
Hoxbro
May 28, 2023, 9:03am
#2
It is hard to determine what exactly the problem is without a minimal, reproducible example (MRE) .
In general, a complete script only with the essential code, which can be copied/pasted and immediately run as-is with no modifications. This is much more useful than snippets.
If you haven’t already, you can take a look at Upgrade Guide — Panel v1.0.3 .
1 Like
goldenbear:
pn.Card(pn.Row(pn.Column(pn.Column("## Cognitive Symptoms", cognitive_symptoms_choice_pm,
sizing_mode = "stretch_height", max_height = 150),
pn.Column("## Emotional Symptoms", emotional_symptoms_choice_pm,
sizing_mode = "stretch_height", max_height = 75),
title = "Please Select All Symptoms That Are Applicable",
collapsible = False, sizing_mode = "stretch_both",
header_background = "#154c79", header_color = "white",
stylesheets = [card_header])
I see, here is a reproducible example:
class PanelCardDemo(param.Parameterized):
cognitive_symptoms_choice = param.ListSelector(objects = [ 'Amnesia', 'Answers Questions More Slowly', 'Aphasia', 'Difficulty Concentrating',
'Difficulty Remembering', 'Feeling Foggy', 'Feeling Slowed Down', 'Feeling More Emotional'], label='')
emotional_symptoms_choice = param.ListSelector(objects = [ 'Irritability', 'Drowsiness', 'Sleep More Than Usual Sleep Disturbance',
'Exertional Headache', 'Positional Headache', 'Pulsatile Throbbing Headache', 'Light Sensitivity', 'Noise Sensitivity',], label='')
def __init__(self,**params):
super().__init__(**params)
cognitive_symptoms_choice_pm = pn.widgets.CheckBoxGroup.from_param(self.param["cognitive_symptoms_choice"],
sizing_mode = "stretch_both", margin = 0, max_height = 50)
emotional_symptoms_choice_pm = pn.widgets.CheckBoxGroup.from_param(self.param["emotional_symptoms_choice"],
sizing_mode = "stretch_both", margin = 0, styles = {'max_height': '25'})
self.layout = pn.Card(pn.Row(pn.Column(pn.Column("## Cognitive Symptoms", cognitive_symptoms_choice_pm,
sizing_mode = "stretch_height", max_height = 150),
pn.Column("## Emotional Symptoms", emotional_symptoms_choice_pm,
sizing_mode = "stretch_height", max_height = 75))),
title = "Please Select All Symptoms That Are Applicable",
collapsible = False, sizing_mode = "stretch_both",
header_background = "#154c79", header_color = "white")
def view(self):
return pn.panel(self.param)
demo = PanelCardDemo()
demo.layout.show()
I would expect it to look like this as it did before
Instead of how it does now
Hoxbro
May 30, 2023, 9:09am
#4
Definitely a bug. For what it is worth, this is a MRE:
import panel as pn
pn.extension()
pn.Card("A", title="This is black", header_background="red", header_color="white")
Edit: This will be fixed in Panel 1.0.4
Got it. Thank you for the help!