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

Bug: Widget name in containers can be confusing if conflicting with Widget attributes #445

Open
tlambert03 opened this issue Aug 23, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@tlambert03
Copy link
Member

tlambert03 commented Aug 23, 2022

Describe the bug
Container Widgets allow convenient subwidget access using attribute access... but this can lead to unexpected results if a widget name clashes with an attribute on Widget. __getitem__ still works, but we should catch these name collisions and provide a more obvious warning

In [1]: from magicgui.widgets import Container, LineEdit

In [2]: edit = LineEdit(name='name', value='hi')

In [3]: container = Container(widgets=[edit])

In [4]: container.name
Out[4]: ''

# but this works
In [5]: container['name']
Out[5]: LineEdit(value='hi', annotation=None, name='name')
@tlambert03 tlambert03 added the bug Something isn't working label Aug 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant