def keyPressEvent (self, event): if event.key ()==Qt.Key_Escape: self.setText ('') else: KLineEdit.keyPressEvent (self, event)