[PyQt] About keyPressEvent

Uğur Çetin ugur.jnmbk at gmail.com
Wed Aug 22 00:47:20 BST 2007


22-08-2007 01:18 Gustavo A. Dí­az:
> I am trying to catch the keyPressEvent of alt + esc combination with:
>
> def keyPressEvent(self, event):
>              if event.key() == QtCore.Qt.Key_Escape:
>                  self.hide()
>
> And this has no effect, the app closes anyway. What i want is to hide
> the app and not close it.
>
> What i am doing wrong?

You should use self.showMinimized() to minimize the window. See QWidget 
documentation. Also see QApplication documentation if you want to use .hide() 
but don't want application to close 
(QApplication.setQuitOnLastWindowClosed()).

-- 
Uğur Çetin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20070822/a392dbff/attachment-0001.bin


More information about the PyQt mailing list