[PyKDE] Make '/keyPressEvent' listening?

Andreas Pakulat apaku at gmx.de
Wed Oct 11 12:15:10 BST 2006


On 11.10.06 12:21:28, Johannes Graumann wrote:
> This pyqt4 documentation is driving me crazy ... took me forever to get the 'ctrl_q' part right, but now I fail to figure out how to make my 'self.maindialog' actually listening to it ... preciously few examples for this on the web, so learning turns out to be hard work.

Have a look at PyQt4 examples, there are pretty many there.

> from PyQt4 import QtGui, QtCore
> ctrl_q = QtGui.QKeyEvent(QtCore.QEvent.KeyPress,QtCore.Qt.Key_Q,QtCore.Qt.ControlModifier)
> if self.maindialog.keyPressEvent(ctrl_q):
>   _slot_Quit_Ctrl_Q

Ok, stop right here. Throw away all code you have. Read and understand
the examples that come with PyQt4 and get a good book on Python/OO
programming. You're clearly lacking OO programming skills and Qt is
OO-only so you need them.

This is not meant offensive, I'm just telling you you won't be able to
resolve your problems unless you get a good idea about OOP (in Python).

Andreas

-- 
Next Friday will not be your lucky day.  As a matter of fact, you don't
have a lucky day this year.




More information about the PyQt mailing list