eibersji
eibersji

Reputation: 1216

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?

Upvotes: 11

Views: 22346

Answers (2)

Yeh
Yeh

Reputation: 71

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

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

Upvotes: 7

MalloyDelacroix
MalloyDelacroix

Reputation: 2293

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)

Upvotes: 23

Related Questions