GLHF GLHF - 1 year ago 105
Python Question

PyQt5 destroy a program properly

I'm using

to hide the application on task bar. However, I realized that even I press
on the right-top corner of the program, it's still running on the background ( I see it on task manager/processes). So that means the program doesn't close properly. Is this because I use
? How can I fix this, that flag option hide program's icon but even if I press
to close the program, it's still running on the background.

Answer Source

I found the solution, make your own quit button and connect the signal like below

self.xbutton = QPushButton(self)

This destroy the app properly. Also instead of Qt.Tool use self.setWindowFlags(QtCore.Qt.FramelessWindowHint)