code: def key_pressed_event(self, event):
          
          if event.key() == self.keys.ESCAPE:
              self.close()
  
          self.example.key_event(event.key(), self.keys.ACTION_PRESS)
docs: Process Qt key press events forwarding them to the example