Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove/Disable Close Button in PyQt5

I have seen questions asking if they can remove the maximize button, but I want to ask if it is possible to remove/disable the close button?

like image 910
eibersji Avatar asked Mar 25 '18 15:03

eibersji


2 Answers

The answer is the same as the answer in the question you linked to. Only a slight change is necessary.

self.setWindowFlag(QtCore.Qt.WindowCloseButtonHint, False)
like image 70
MalloyDelacroix Avatar answered Nov 13 '22 16:11

MalloyDelacroix


The CustomizeWindowHint flag needs to be set first before the WindowCloseButtonHint flag can be changed.

See https://stackoverflow.com/a/27496734

like image 44
Marsy Avatar answered Nov 13 '22 16:11

Marsy