Index: lib/matplotlib/pyplot.py
===================================================================
--- lib/matplotlib/pyplot.py	(revision 5735)
+++ lib/matplotlib/pyplot.py	(working copy)
@@ -335,7 +335,21 @@
 if Figure.ginput.__doc__ is not None:
     ginput.__doc__ = dedent(Figure.ginput.__doc__)
 
+def waitforbuttonpress(*args, **kwargs):
+    """
+    Blocking call to interact with the figure.
 
+    This will wait for *n* key or mouse clicks from the user and
+    return a list containing True's for keyboard clicks and False's
+    for mouse clicks.
+
+    If *timeout* is negative, does not timeout.
+    """
+    return gcf().waitforbuttonpress(*args, **kwargs)
+if Figure.waitforbuttonpress.__doc__ is not None:
+    waitforbuttonpress.__doc__ = dedent(Figure.waitforbuttonpress.__doc__)
+
+
 # Putting things in figures
 
 def figtext(*args, **kwargs):
Index: lib/matplotlib/figure.py
===================================================================
--- lib/matplotlib/figure.py	(revision 5735)
+++ lib/matplotlib/figure.py	(working copy)
@@ -6,6 +6,9 @@
 :class:`SubplotParams`
     control the default spacing of the subplots
 
+:class:`BlockingKeyMouseInput`
+    creates a callable object to retrieve key or mouse clicks in a blocking way for interactive sessions
+
 :class:`BlockingMouseInput`
     creates a callable object to retrieve mouse clicks in a blocking way for interactive sessions
 
@@ -118,6 +121,78 @@
         setattr(self, s, val)
 
 
+class BlockingKeyMouseInput(object):
+    """
+    Class that creates a callable object to retrieve key or mouse clicks in a
+    blocking way.
+    """
+    def __init__(self, fig):
+        self.fig = fig
+
+
+    def on_mouse_click(self, event):
+        """
+        Event handler that will be passed to the current figure to
+        retrieve clicks.
+        """
+        self.events.append(event)
+        self.buttons.append(event.button)
+        self.keyormouse.append(False)
+        
+        if len(self.keyormouse) >= self.n:
+            self.done = True
+
+    def on_key_click(self, event):
+        """
+        Event handler that will be passed to the current figure to
+        retrieve key presses.
+        """
+        self.events.append(event)
+        self.keys.append(event.key)
+        self.keyormouse.append(True)
+
+        if len(self.keyormouse) >= self.n:
+            self.done = True
+
+    def __call__(self, n=1, timeout=-1 ):
+        """
+        Blocking call to retrieve n key or mouse events
+        """
+        self.done        = False
+        self.keys      = []
+        self.buttons       = []
+        self.events       = []
+        self.keyormouse = []
+
+        assert isinstance(n, int), "Requires an integer argument"
+        self.n = n
+
+        # Ensure that the figure is shown
+        self.fig.show()
+        # connect the click events to the on_click function call
+        self.callbackm = self.fig.canvas.mpl_connect('button_press_event',
+                                                     self.on_mouse_click)
+        self.callbackk = self.fig.canvas.mpl_connect('key_press_event',
+                                                    self.on_key_click)
+        # wait for n clicks
+        counter = 0
+        while not self.done:
+            self.fig.canvas.flush_events()
+            time.sleep(0.01)
+
+            # check for a timeout
+            counter += 1
+            if timeout > 0 and counter > timeout/0.01:
+                print "Timeout reached";
+                break;
+
+        # Disconnect the event, clean the figure, and return what we have
+        self.fig.canvas.mpl_disconnect(self.callbackm)
+        self.callbackm = None
+        self.fig.canvas.mpl_disconnect(self.callbackk)
+        self.callbackk = None
+        return (self.keyormouse,self.keys,self.buttons,self.events)
+
 class BlockingMouseInput(object):
     """
     Class that creates a callable object to retrieve mouse clicks in a
@@ -1119,8 +1194,25 @@
         return blocking_mouse_input(n=n, timeout=timeout,
                                           verbose=verbose, show_clicks=True)
 
+    def waitforbuttonpress(self, n=1, timeout=-1):
+        """
+        call signature::
 
+          waitforbuttonpress(self, n=1, timeout=-1)
 
+        Blocking call to interact with the figure.
+
+        This will wait for *n* key or mouse clicks from the user and
+        return a list containing True's for keyboard clicks and
+        False's for mouse clicks.
+
+        If *timeout* is negative, does not timeout.
+        """
+
+        blocking_input = BlockingKeyMouseInput(self)
+        return blocking_input(n=n, timeout=timeout)[0]
+
+
 def figaspect(arg):
     """
     Create a figure with specified aspect ratio.  If *arg* is a number,
