[PyQt] About keyPressEvent

"Gustavo A. Dí­az" gustavo.diaz at gmail.com
Wed Aug 22 00:56:11 BST 2007


I forgot, that code only hide the app when i press Esc key, i want alt +
Esc key combination to do the same...

Thanks.

Uğur Çetin escribió:
> 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()).
>
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt


-- 
/Gustavo A. Díaz/
*GDNet Projects*
www.gdnet.com.ar <http://www.gdnet.com.ar>
Gustavo A. Díaz
-------------- next part --------------
Skipped content of type multipart/related


More information about the PyQt mailing list