The min() function is, indeed, a standard Python function but it not the root cause of the message.
The mousePressEvent() function has two arguments:
- the object pointer
- the QMouseEvent
Your implementation only takes one argument.
This works better:
I am not entirely sure it a clean approach though.Qt Code:
def min(self, event): self.setWindowState(self.windowState() | QWindow.Minimized) event.accept()To copy to clipboard, switch view to plain text mode
I would also consider:
- making the three buttons actual QPushButtons and doing this plumbing with signal/slot connections rather than hijacking the event handler
- Using layouts to place widgets within the parent widget
Bookmarks