coldlin
2nd October 2007, 19:56
Hi to all!!
I'm new with python and qt, and i'm trying to make my program,written with pyqt4 in linux, execute some code when I press a keyboard button. I can't understand how to implement the keyPressEvent in my program :(
Searching with google i found this:
class Test(QtGui.QTextEdit):
def keyPressEvent(self, e):
print e.key()
e.ignore()
but this won't work to me, 'cause it declares a QTextEdit class, but i use a QWidget, so the .key() doesn't work :(
How can I do?? Thaks to all!!!
P.S. Sorry for the ignorance and the english.
I'm new with python and qt, and i'm trying to make my program,written with pyqt4 in linux, execute some code when I press a keyboard button. I can't understand how to implement the keyPressEvent in my program :(
Searching with google i found this:
class Test(QtGui.QTextEdit):
def keyPressEvent(self, e):
print e.key()
e.ignore()
but this won't work to me, 'cause it declares a QTextEdit class, but i use a QWidget, so the .key() doesn't work :(
How can I do?? Thaks to all!!!
P.S. Sorry for the ignorance and the english.