def keyPressEvent(self, event: QKeyEvent): key = event.key() if key in self.keys: self.keys[key] = True