@@ -2446,20 +2446,51 @@ def button_press_handler(event, canvas, toolbar=None):
24462446
24472447
24482448class NonGuiException (Exception ):
2449+ """Raised when trying show a figure in a non-GUI backend."""
24492450 pass
24502451
24512452
24522453class FigureManagerBase (object ):
2453- """
2454- Helper class for pyplot mode, wraps everything up into a neat bundle
2454+ r"""
2455+ A backend-independent abstraction of a figure container and controller.
2456+
2457+ The figure manager is used by pyplot to interact with the window in a
2458+ backend-independent way. It's an adapter for the real (GUI) framework that
2459+ represents the visual figure on screen.
2460+
2461+ GUI backends define from this class to translate common operations such
2462+ as *show* or *resize* to the GUI-specific code. Non-GUI backends do not
2463+ support these operations an can just use the base class.
2464+
2465+ This following basic operations are accessible:
2466+
2467+ **Window operations**
2468+
2469+ - `~.FigureManagerBase.show`
2470+ - `~.FigureManagerBase.destroy`
2471+ - `~.FigureManagerBase.full_screen_toggle`
2472+ - `~.FigureManagerBase.resize`
2473+ - `~.FigureManagerBase.get_window_title`
2474+ - `~.FigureManagerBase.set_window_title`
2475+
2476+ **Key and mouse button press handling**
2477+
2478+ The manager allows to process matplotlib `.Event`\s.
2479+
2480+ **Other operations**
2481+
2482+ Subclasses will have additional attributes and functions to access
2483+ additional functionality. This is of course backend-specific. For example,
2484+ most GUI backends have ``window`` and ``toolbar`` attributes that give
2485+ access to the native GUI widgets of the respective framework.
24552486
24562487 Attributes
24572488 ----------
24582489 canvas : :class:`FigureCanvasBase`
2459- The backend-specific canvas instance
2490+ The backend-specific canvas instance.
24602491
24612492 num : int or str
2462- The figure number
2493+ The figure number.
24632494
24642495 key_press_handler_id : int
24652496 The default key handler cid, when using the toolmanager.
@@ -2474,7 +2505,6 @@ class FigureManagerBase(object):
24742505
24752506 figure.canvas.mpl_disconnect(
24762507 figure.canvas.manager.button_press_handler_id)
2477-
24782508 """
24792509 def __init__ (self , canvas , num ):
24802510 self .canvas = canvas
@@ -2516,20 +2546,18 @@ def full_screen_toggle(self):
25162546 pass
25172547
25182548 def resize (self , w , h ):
2519- """" For GUI backends, resize the window (in pixels)."""
2549+ """For GUI backends, resize the window (in pixels)."""
25202550
25212551 def key_press (self , event ):
25222552 """
25232553 Implement the default mpl key bindings defined at
2524- :ref:`key-event-handling`
2554+ :ref:`key-event-handling`.
25252555 """
25262556 if rcParams ['toolbar' ] != 'toolmanager' :
25272557 key_press_handler (event , self .canvas , self .canvas .toolbar )
25282558
25292559 def button_press (self , event ):
2530- """
2531- The default Matplotlib button actions for extra mouse buttons.
2532- """
2560+ """The default Matplotlib button actions for extra mouse buttons."""
25332561 if rcParams ['toolbar' ] != 'toolmanager' :
25342562 button_press_handler (event , self .canvas , self .canvas .toolbar )
25352563
0 commit comments