python - Application closes when it's hidden and I close a modal dialog -


this question has answer here:

i'm developing application "run in tray" of time, , displays dialogs user (these dialogs modal)

the problem i've run when user closes dialog (using accept() or reject()) while main window (the parent of modal dialog) hidden whole application closed!

there no problem modeless dialogs

the workaround i'm using call show() on parent (the main window) first , after close modal dialog

is there better way solve or avoid problem? or approach i'm using way deal issue?

i'm using pyqt 5.7.1 (same qt version) , running on lubuntu 16.04 64-bit

grateful help!

you need set quitonlastwindowclosed property on qapplication object false, show below::

if __name__ == '__main__':      import sys      app = qapplication(sys.argv)      if not qsystemtrayicon.issystemtrayavailable():         qmessagebox.critical(none, "systray",                 "i couldn't detect system tray on system.")         sys.exit(1)      qapplication.setquitonlastwindowclosed(false)      window = yourdialog()     window.show()     sys.exit(app.exec_()) 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -