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

MainWindow and Container exhibit assymetric behavior on .close() #685

Open
bruno-f-cruz opened this issue Dec 25, 2024 · 1 comment · May be fixed by #686
Open

MainWindow and Container exhibit assymetric behavior on .close() #685

bruno-f-cruz opened this issue Dec 25, 2024 · 1 comment · May be fixed by #686
Labels
bug Something isn't working

Comments

@bruno-f-cruz
Copy link

Describe the bug
First of all, I apologize if this is indeed the intended behavior.
When calling close on MainWindow and Container I am getting different outcomes. Container closes the UI element and exits the context, while MainWindow closes the inner element but not the OS window.

To Reproduce

from magicgui import event_loop
from magicgui.widgets import Button, MainWindow, Container

button = Button(text="Submit")
container = Container(widgets=[button])
# container = MainWindow(widgets=[button])  # Replace me

button.changed.connect(container.close)

with event_loop() as loop:
    container.show()

Expected behavior
The close behavior to be symmetric. Otherwise, is there an intended alternative to close the context from MainWindow?

Environment (please complete the following information):

  • OS: Win11
  • backend: [e.g. Qt6]
  • magicgui version 0.10.0
@bruno-f-cruz bruno-f-cruz added the bug Something isn't working label Dec 25, 2024
@tlambert03
Copy link
Member

yeah, this is a bug... not the intended behavior. It occurs because the _qtpy.widgets.MainWindow object has a container... rather than is a container, but that should be fixed. I agree with your expected behavior.

@tlambert03 tlambert03 linked a pull request Jan 5, 2025 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants