@@ -2446,20 +2446,51 @@ def button_press_handler(event, canvas, toolbar=None):
2446
2446
2447
2447
2448
2448
class NonGuiException (Exception ):
2449
+ """Raised when trying show a figure in a non-GUI backend."""
2449
2450
pass
2450
2451
2451
2452
2452
2453
class 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.
2455
2486
2456
2487
Attributes
2457
2488
----------
2458
2489
canvas : :class:`FigureCanvasBase`
2459
- The backend-specific canvas instance
2490
+ The backend-specific canvas instance.
2460
2491
2461
2492
num : int or str
2462
- The figure number
2493
+ The figure number.
2463
2494
2464
2495
key_press_handler_id : int
2465
2496
The default key handler cid, when using the toolmanager.
@@ -2474,7 +2505,6 @@ class FigureManagerBase(object):
2474
2505
2475
2506
figure.canvas.mpl_disconnect(
2476
2507
figure.canvas.manager.button_press_handler_id)
2477
-
2478
2508
"""
2479
2509
def __init__ (self , canvas , num ):
2480
2510
self .canvas = canvas
@@ -2516,20 +2546,18 @@ def full_screen_toggle(self):
2516
2546
pass
2517
2547
2518
2548
def resize (self , w , h ):
2519
- """" For GUI backends, resize the window (in pixels)."""
2549
+ """For GUI backends, resize the window (in pixels)."""
2520
2550
2521
2551
def key_press (self , event ):
2522
2552
"""
2523
2553
Implement the default mpl key bindings defined at
2524
- :ref:`key-event-handling`
2554
+ :ref:`key-event-handling`.
2525
2555
"""
2526
2556
if rcParams ['toolbar' ] != 'toolmanager' :
2527
2557
key_press_handler (event , self .canvas , self .canvas .toolbar )
2528
2558
2529
2559
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."""
2533
2561
if rcParams ['toolbar' ] != 'toolmanager' :
2534
2562
button_press_handler (event , self .canvas , self .canvas .toolbar )
2535
2563
0 commit comments