code: def keyPressEvent(self, event):
          
          # reject on a cancel
          if event.key() == Qt.Key_Escape:
              self.reject()
          
          super(XSnapshotWidget, self).keyPressEvent(event)
docs: Listens for the escape key to cancel out from this snapshot.
          
          :param      event | <QKeyPressEvent>