Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving a widget in a grid #2482

Open
ellahas opened this issue May 1, 2023 · 1 comment
Open

Moving a widget in a grid #2482

ellahas opened this issue May 1, 2023 · 1 comment

Comments

@ellahas
Copy link

ellahas commented May 1, 2023

I would like to be able to move a widget to a different index dynamically. Specifically, I want to remove widgets temporarily and have the remaining widgets take up their space until the removed widgets are added again, while keeping the relative order of the widgets.

Is there a way I can do this? My main problem is that when resizing widgets to take up more rows, it always happens downwards, so if I want a widget on top to be gone and a widget below to take up the space, it cannot be done by using the resize method.

Thanks in advance!

@djhoese
Copy link
Member

djhoese commented May 1, 2023

Gridding logic is handled in the Grid widget in vispy here:

https://github.com/vispy/vispy/blob/main/vispy/scene/widgets/grid.py

This is based on kiwisolver to handle all the sizing and arrangement:

https://kiwisolver.readthedocs.io/en/latest/

We only provide access to the row, column, row span, and column span when adding a widget. If this is not enough to get the behavior you're looking for I think changes would have to be made to Grid to allow for it. I'm sorry, but I'm not very experienced with controlling this type of stuff with kiwisolver. You might be able to set certain aspects of this with the Widget.padding and Widget.margin keyword arguments and properties or the Widget.stretch property to get a little more control. Oh I also see width_min and width_max properties on the Widget class so you might be able to control that too. This is just what I've found from skimming the widget.py source code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants