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

Warning when launching GUI #25

Open
GiuseppeCiccone96 opened this issue Apr 21, 2022 · 6 comments
Open

Warning when launching GUI #25

GiuseppeCiccone96 opened this issue Apr 21, 2022 · 6 comments

Comments

@GiuseppeCiccone96
Copy link

Hi,

I get this warning whenever I use my magic-class built GUI - do you know where it comes from?

qt.qpa.window: <QNSWindow: 0x137414bf0; contentView=<QNSView: 0x1374147e0; QCocoaWindow(0x60000382cd10, window=QWidgetWindow(0x600002b05260, name="magicgui.QPushButtonWindow"))>> has active key-value observers (KVO)! These will stop working now that the window is recreated, and will result in exceptions when the observers are removed. Break in QCocoaWindow::recreateWindowIfNeeded to debug.
qt.qpa.window: <QNSWindow: 0x13740fac0; contentView=<QNSView: 0x13740f6b0; QCocoaWindow(0x60000382ca50, window=QWidgetWindow(0x600002b3fc00, name="Prepare ExperimentWindow"))>> has active key-value observers (KVO)! These will stop working now that the window is recreated, and will result in exceptions when the observers are removed. Break in QCocoaWindow::recreateWindowIfNeeded to debug.
qt.qpa.window: <QNSWindow: 0x13744cd50; contentView=<QNSView: 0x13744c860; QCocoaWindow(0x60000382cd10, window=QWidgetWindow(0x600002b07600, name="magicgui.QPushButtonWindow"))>> has active key-value observers (KVO)! These will stop working now that the window is recreated, and will result in exceptions when the observers are removed. Break in QCocoaWindow::recreateWindowIfNeeded to debug.
qt.qpa.window: <QNSWindow: 0x114f067a0; contentView=<QNSView: 0x114f06390; QCocoaWindow(0x600003830000, window=QWidgetWindow(0x600002b2e100, name="VisualizationWindow"))>> has active key-value observers (KVO)! These will stop working now that the window is recreated, and will result in exceptions when the observers are removed. Break in QCocoaWindow::recreateWindowIfNeeded to debug.
qt.qpa.window: <QNSWindow: 0x137457e70; contentView=<QNSView: 0x137457a60; QCocoaWindow(0x60000382cfd0, window=QWidgetWindow(0x600002b1b960, name="Further OptionsWindow"))>> has active key-value observers (KVO)! These will stop working now that the window is recreated, and will result in exceptions when the observers are removed. Break in QCocoaWindow::recreateWindowIfNeeded to debug.

thanks a lot,

Giuseppe

@hanjinliu
Copy link
Owner

Hi @GiuseppeCiccone96
I've never seen that kind of errors...
Can you tell me the OS, qtpy version, pyqt/pyside version you are using?

@GiuseppeCiccone96
Copy link
Author

Maybe it's the way the GUI is set up...
macOS Monterey Version 12.1
qtpy 2.0.1
pyqt 5.15.2

@GiuseppeCiccone96
Copy link
Author

this is the code:

https://github.com/GiuseppeCiccone96/bulkrheogui

@hanjinliu
Copy link
Owner

Strangely I could not reproduce the warning (on Windows).
The Qt versions are following:

qtpy                      2.0.1
pyqt5                     5.15.6
pyqt5-qt5                 5.15.2
pyqt5-sip                 12.10.1

The only change I applied to your code is deleting the line mpl.use('qtagg') because I did not work from IPython but I don't think this would be the reason.
I'll check it later with MacBook.

@hanjinliu
Copy link
Owner

Hi @GiuseppeCiccone96,
Finally I found why it happens.
It seems that in MacOS, recreation of Qt window is not allowed. Even in following example I got the similar warning.

from magicgui.widgets import Container, PushButton

button = PushButton()
button.show()

c = Container()
c.show()

c.append(button)  # warning here!

This might be a bug in Qt, but I think I can somehow solve this problem on my side by avoiding unnecessary window creation.
Thanks for the report!

@GiuseppeCiccone96
Copy link
Author

Thanks a lot for the clarification :)!

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