Open MarcSkovMadsen opened 2 years ago
I can trigger a resize by temporarily changing the sizing_mode
.
import panel as pn
pn.extension(sizing_mode="stretch_width", template="fast")
logo_url= "https://pydata.org/wp-content/uploads/2019/06/pydata-logo-final.png"
ACCENT = "orange"
pn.pane.PNG(logo_url, embed=True, height=500, sizing_mode="scale_width").servable(area="sidebar")
def model(count=5):
return "# Hello PyData World\n"*count
slider = pn.widgets.IntSlider(value=5, start=0, end=10, name="count").servable(area="sidebar")
imodel = pn.bind(model, count=slider)
model_panel = pn.panel(imodel, sizing_mode="stretch_both").servable()
@pn.depends(slider, watch=True)
def hacky_workaround(slider):
model_panel.sizing_mode="fixed"
model_panel.sizing_mode="stretch_both"
pn.state.template.param.update(site="PyData Cph 2022", title="Introduction to Data Apps with Panel")
I believe a bug like this is REALLY, REALLY important to fix as it is bugs like these that make @pn.depends
/@pn.bind
not nearly as powerful as they should be and having users spend so much more time on fixing layout issues than they have to with competing frameworks.
I would expect the below to resize its container. But the height stays fixed, end ends up overflowing the card.
https://user-images.githubusercontent.com/42288570/162560111-cd2df69a-7c91-4a26-8a52-368bdf4c9d0b.mp4