Commit 3e66047
committed
Simplify connection of the default key_press and button_press handlers.
It likely doesn't make much sense to call `key_press_handler` or
`button_press_handler` with `canvas != event.canvas` or
`toolbar != event.canvas.toolbar` (the default Toolbar constructor sets
itself as this attribute on the canvas), so we can just make these
parameters optional and fill them in from `event`. This means that
connecting these handlers is now just
`canvas.mpl_connect("key_press_event", key_press_handler)`, rather than
having to create an intermediate function to adjust the signature (see
change in embedding_in_tk_sgskip.py).
`canvas` and `toolbar` could probably even be deleted, but I'm not sure
the API change is actually worth it -- plus there may be someone
somewhere who actually has a use case for `toolbar` not matching
`event.canvas.toolbar`...1 parent 065769b commit 3e66047Copy full SHA for 3e66047
File tree
Expand file treeCollapse file tree
3 files changed
+34
-15
lines changedOpen diff view settings
Filter options
- doc/users/next_whats_new
- examples/user_interfaces
- lib/matplotlib
Expand file treeCollapse file tree
3 files changed
+34
-15
lines changedOpen diff view settings
Collapse file
doc/users/next_whats_new/2020-04-13-AL.rst
Copy file name to clipboard+7Lines changed: 7 additions & 0 deletions
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
Collapse file
examples/user_interfaces/embedding_in_tk_sgskip.py
Copy file name to clipboardExpand all lines: examples/user_interfaces/embedding_in_tk_sgskip.py+3-6Lines changed: 3 additions & 6 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
31 | 31 | |
32 | 32 | |
33 | 33 | |
34 | | - |
35 | | - |
36 | | - |
37 | | - |
38 | | - |
39 | | - |
| 34 | + |
| 35 | + |
| 36 | + |
40 | 37 | |
41 | 38 | |
42 | 39 | |
|
Collapse file
lib/matplotlib/backend_bases.py
Copy file name to clipboardExpand all lines: lib/matplotlib/backend_bases.py+24-9Lines changed: 24 additions & 9 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
2306 | 2306 | |
2307 | 2307 | |
2308 | 2308 | |
2309 | | - |
| 2309 | + |
2310 | 2310 | |
2311 | 2311 | |
2312 | 2312 | |
2313 | 2313 | |
2314 | 2314 | |
2315 | 2315 | |
2316 | 2316 | |
2317 | | - |
2318 | | - |
2319 | | - |
2320 | | - |
2321 | | - |
| 2317 | + |
| 2318 | + |
| 2319 | + |
| 2320 | + |
| 2321 | + |
| 2322 | + |
| 2323 | + |
| 2324 | + |
| 2325 | + |
2322 | 2326 | |
2323 | 2327 | |
2324 | 2328 | |
2325 | 2329 | |
2326 | 2330 | |
| 2331 | + |
| 2332 | + |
| 2333 | + |
| 2334 | + |
2327 | 2335 | |
2328 | 2336 | |
2329 | 2337 | |
| ||
2483 | 2491 | |
2484 | 2492 | |
2485 | 2493 | |
2486 | | - |
| 2494 | + |
2487 | 2495 | |
2488 | 2496 | |
| 2497 | + |
| 2498 | + |
| 2499 | + |
2489 | 2500 | |
| 2501 | + |
| 2502 | + |
| 2503 | + |
| 2504 | + |
2490 | 2505 | |
2491 | 2506 | |
2492 | 2507 | |
| ||
2610 | 2625 | |
2611 | 2626 | |
2612 | 2627 | |
2613 | | - |
| 2628 | + |
2614 | 2629 | |
2615 | 2630 | |
2616 | 2631 | |
2617 | 2632 | |
2618 | | - |
| 2633 | + |
2619 | 2634 | |
2620 | 2635 | |
2621 | 2636 | |
|
0 commit comments