PyQt's magical disappearing (but not reappearing) windows on Mac OS X

Alec Jacobson

November 16, 2009

weblog/

After the grueling Qt and PyQt installation process on my Mac OS X 10.5 machine, I have PyQt up and running. I made a little hello, window type app for a sanity test and found a very puzzling feature. PyQt can make a resizable window which the mouse can resize to nothing! This is not allowed through the API methods (namely widget.resize(...,...)), with those the window always keeps a minimum width and height. But the user is allowed to drag the window to nothingness. If the user lets go while the window has non-positive dimensions then the window is lost forever as far as the mouse user is concerned. Here's the simple PyQt code:
import sys
from PyQt4 import QtGui

app = QtGui.QApplication(sys.argv)
widget = QtGui.QWidget()
widget.show()
sys.exit(app.exec_())
And here are some screenshots of the result: pyqt-disappearing-window-01.png pyqt-disappearing-window-02.png pyqt-disappearing-window-03.png pyqt-disappearing-window-04.png pyqt-disappearing-window-05.png pyqt-disappearing-window-06.png pyqt-disappearing-window-07.png pyqt-disappearing-window-08.png Update: Here's an animated gif version illustrating the above: pyqt disappearing window animated gif Update: Shucks! Seems like this is fixed in the new version of PyQt4 that I just got.

Comments

December 25, 2009, Colin
You should make a gif of this, -Colin