Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a7640ef

Browse files
committed
rename navigation to toolmanager
1 parent d4ac2fb commit a7640ef

File tree

7 files changed

+542
-541
lines changed

7 files changed

+542
-541
lines changed

examples/user_interfaces/navigation.py renamed to examples/user_interfaces/toolmanager.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ class allows to:
88

99
from __future__ import print_function
1010
import matplotlib
11-
matplotlib.use('GTK3Cairo')
12-
matplotlib.rcParams['toolbar'] = 'navigation'
11+
# matplotlib.use('GTK3Cairo')
12+
matplotlib.use('Tkagg')
13+
matplotlib.rcParams['toolbar'] = 'toolmanager'
1314
import matplotlib.pyplot as plt
1415
from matplotlib.backend_tools import ToolBase
1516
from gi.repository import Gtk, Gdk
@@ -27,19 +28,19 @@ def trigger(self, *args, **kwargs):
2728
'Tool description',
2829
'Keymap'))
2930
print('-' * 80)
30-
tools = self.navigation.tools
31+
tools = self.toolmanager.tools
3132
for name in sorted(tools.keys()):
3233
if not tools[name].description:
3334
continue
34-
keys = ', '.join(sorted(self.navigation.get_tool_keymap(name)))
35+
keys = ', '.join(sorted(self.toolmanager.get_tool_keymap(name)))
3536
print("{0:12} {1:45} {2}".format(name,
3637
tools[name].description,
3738
keys))
3839
print('_' * 80)
3940
print("Active Toggle tools")
4041
print("{0:12} {1:45}".format("Group", "Active"))
4142
print('-' * 80)
42-
for group, active in self.navigation.active_toggle.items():
43+
for group, active in self.toolmanager.active_toggle.items():
4344
print("{0:12} {1:45}".format(group, active))
4445

4546

@@ -61,15 +62,15 @@ def trigger(self, *args, **kwargs):
6162
plt.plot([1, 2, 3])
6263

6364
# Add the custom tools that we created
64-
fig.canvas.manager.navigation.add_tool('List', ListTools)
65-
fig.canvas.manager.navigation.add_tool('copy', CopyToolGTK3)
65+
fig.canvas.manager.toolmanager.add_tool('List', ListTools)
66+
# fig.canvas.manager.toolmanager.add_tool('copy', CopyToolGTK3)
6667

6768
# Add an existing tool to new group `foo`.
6869
# It can be added as many times as we want
6970
fig.canvas.manager.toolbar.add_tool('zoom', 'foo')
7071

7172
# Remove the forward button
72-
fig.canvas.manager.navigation.remove_tool('forward')
73+
fig.canvas.manager.toolmanager.remove_tool('forward')
7374

7475
# To add a custom tool to the toolbar at specific location
7576
fig.canvas.manager.toolbar.add_tool('List', 'navigation', 1)

0 commit comments

Comments
 (0)