PyQt5 - self.hide causes app to terminate
-
Hi,
I am currently writing my first project based on PyQt5. You can find the source here: https://github.com/corelan/pyencfsgui
For some reason, when I try to hide the main window using self.hide(), the application terminates.
Does anyone know what I'm doing wrong?
thanks !
-
Hi,
Do you mean you would like your GUI application to continue running even without any widget available ?
By the way, what version of PyQt5 or PySide2 are you using ?
On what OS ? -
Hi,
Do you mean you would like your GUI application to continue running even without any widget available ?
By the way, what version of PyQt5 or PySide2 are you using ?
On what OS ?@SGaist nvm fixed it - to launch my app, I was using <mainwindow>.exec_ instead of app.exec_. Doing a self.hide on the mainwindow made it terminate. Changing it to app.exec_ fixed it.
-
@SGaist nvm fixed it - to launch my app, I was using <mainwindow>.exec_ instead of app.exec_. Doing a self.hide on the mainwindow made it terminate. Changing it to app.exec_ fixed it.
@corelanc0d3r
For the record: hiding/closing the main window made your application terminate because of https://doc.qt.io/qt-5/qguiapplication.html#quitOnLastWindowClosed-propThis property holds whether the application implicitly quits when the last window is closed.
The default is
true.If this property is
true, the applications quits when the last visible primary window (i.e. window with no parent) is closed. -
@corelanc0d3r
For the record: hiding/closing the main window made your application terminate because of https://doc.qt.io/qt-5/qguiapplication.html#quitOnLastWindowClosed-propThis property holds whether the application implicitly quits when the last window is closed.
The default is
true.If this property is
true, the applications quits when the last visible primary window (i.e. window with no parent) is closed.@JonB cool, good to know ! :)