jmosbacher / pydantic-panel

Edit pydantic models with widgets from the awesome Panel package
MIT License
24 stars 3 forks source link

sizing_mode="stretch_width" does not work #15

Open MarcSkovMadsen opened 2 years ago

MarcSkovMadsen commented 2 years ago

I almost always use sizing_mode="stretch_width". But I can see its not supported.

image

import pydantic

class SomeModel(pydantic.BaseModel):
   name: str
   value: float

import panel as pn

import pydantic_panel as pp

pn.extension()

pn.panel(SomeModel, sizing_mode="stretch_width")

widget = pn.panel(SomeModel)
layout = pn.Column(widget, widget.json)
layout.servable()
MarcSkovMadsen commented 2 years ago

Workaround

Adding pn.extension(sizing_mode="stretch_width") makes it work

image

MarcSkovMadsen commented 2 years ago

Please note I added a request to get the margin of the JSON pane adjusted. See https://github.com/holoviz/panel/issues/3736

jmosbacher commented 2 years ago

Yeah I still havent decided on a strategy for propagating sizing options down to sub widgets. Some sub widgets are naturally larger then others and also depends on whether the subwidgets are in a Row-like container or Column-like. SO I'm expecting it to be not trivial to do right. Suggestions are very welcome, although probably wont have time to implement in very near future.