pyapp-kit / magicgui

build GUIs from type annotations
https://pyapp-kit.github.io/magicgui/
MIT License
371 stars 49 forks source link

Improve nesting of containers with labels (group box) #317

Open aeisenbarth opened 2 years ago

aeisenbarth commented 2 years ago

Sometimes you want to structure user interfaces by grouping widgets. Currently when adding two containers A and B to a Napari dock (a parent container), the widgets in the nested containers are displayed in a continuous flow and the grouping is not recognizable by users.

A possibility is to set a label for A and B and enable label display on the parent container. However, as with normal widgets, Container labels are displayed on the left, squeezing the container content to the right. In this example, Segmentation is a container with vertical layout for which I would like to have the container's label displayed above its content and the container separated by a border from other widgets. Shape is also a container (horizontal layout), as an example that the current behavior can also be desirable to keep.

It would be nice to have something like QGroupBox which could either be its own magicgui widget or an option for Container.

michaels10 commented 2 years ago

Came up for me too. Any news on fixing this?

ndxmrb commented 2 months ago

Hi, I'd love to have this feature as well.

In case anyone using pydantic models is wondering how to get what is shown above in the first place, please refer to this post and/or #669.