Example #1
0
    def _getEvent(self):
        """Return an event generated by a keypress or mouse click
        """
        ev = interface.Event("q")

        if self.verbose:
            print("virtual[%s]._getEvent() -> %s" % (self.display.frame, ev))

        return ev
 def post_event(self):
     """
     Return the event containing the key and (x, y)
     """
     try:
         event = self.events[-1]
     except IndexError:
         ## details of the event to pass back to the display
         self.ev = None
     else:
         self.ev = interface.Event(event.key, event.xdata, event.ydata)
    def _getEvent(self, timeout=-1):
        """Listen for a key press, returning (key, x, y)"""

        mpBackend = matplotlib.get_backend()
        if mpBackend not in interactiveBackends:
            print(
                "The %s matplotlib backend doesn't support display._getEvent()"
                % (matplotlib.get_backend(), ),
                file=sys.stderr)
            return interface.Event('q')

        blocking_input = BlockingKeyInput(self._figure)
        return blocking_input(timeout=timeout)
Example #4
0
    def _getEvent(self, timeout=-1):
        """Listen for a key press, returning (key, x, y)"""

        if timeout < 0:
            timeout = 24*3600           # -1 generates complaints in QTimer::singleShot.  A day is a long time

        mpBackend = matplotlib.get_backend()
        if mpBackend not in interactiveBackends:
            print("The %s matplotlib backend doesn't support display._getEvent()" %
                  (matplotlib.get_backend(),), file=sys.stderr)
            return interface.Event('q')

        blocking_input = BlockingKeyInput(self._figure)
        return blocking_input(timeout=timeout)