[PyQt] About keyPressEvent

Sundance sundance at ierne.eu.org
Wed Aug 22 09:20:42 BST 2007


Gustavo A. Dí­az wrote:

> As i said, only Escape key.
>
> I want to know to do the same but with alt + Escape....... or which
> is the way to do it...

Hi Gustavo,

I am not sure I understand what it is that gives you trouble here. Is it 
that you don't know how to go about it, or is it that it doesn't work 
properly for you?

In case it's the former, you will probably want to wrap the window 
hiding code under a QAction, and give that QAction the 
shortcut 'Alt+Esc' with QAction.setShortcut().

Remember that a QAction must be added to a widget (with 
QWidget.addAction()) before its shortcut will work.

With kind regards,

-- S.



More information about the PyQt mailing list