how to disable the window maximize icon using PyQt4?

Haven't worked with it but research seems to point to messing with the window flags.

QWidget has a method called setWindowFlags.

Here is the doc for the Qt.WindowFlags class.

Here is a reference for all of the flags. Look for Qt.WindowMaximizeButtonHint

In general it seems like you need to find a way to enable the Qt.CustomizeWindowHint flag and disable the Qt.WindowMaximizeButtonHint flag. Either way, you probably want this in addition to setFixedSize so that's a good start.

Edit:

Something like

win.setWindowFlags(win.windowFlags() | QtCore.Qt.CustomizeWindowHint)
win.setWindowFlags(win.windowFlags() & ~QtCore.Qt.WindowMaximizeButtonHint)

Assuming your import is something like this

from PyQt4 import QtCore

This would turn on the CustomizeWindowHint flag and turn off the WindowMaximizeButtonHint flag, I hope. Let me know if this works at all.

Edit:

As discovered by OP, the only call necessary for his desired outcome:

win.setWindowFlags(QtCore.Qt.WindowMinimizeButtonHint)

but beware, since this will also remove the close button and potentially mess with other window flags.


This works perfectly:

MainWindow.setWindowFlags(QtCore.Qt.WindowCloseButtonHint | QtCore.Qt.WindowMinimizeButtonHint)

you could set the maximumSize and minimumSize with the same values, it'll get to dissapear maximise button