Skip to content

Commit a2ed47f

Browse files
committed
using pydispatch
1 parent 44a9b0e commit a2ed47f

File tree

4 files changed

+192
-193
lines changed

4 files changed

+192
-193
lines changed

examples/user_interfaces/navigation.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
matplotlib.rcParams['toolbar'] = 'navigation'
55
import matplotlib.pyplot as plt
66
from matplotlib.backend_tools import ToolBase
7-
7+
from pydispatch import dispatcher
88

99
# Create a simple tool to list all the tools
1010
class ListTools(ToolBase):
@@ -14,7 +14,7 @@ class ListTools(ToolBase):
1414

1515
def trigger(self, event):
1616
tools = self.navigation.get_tools()
17-
17+
1818
print ('_' * 80)
1919
print ("{0:12} {1:45} {2}".format('Name (id)',
2020
'Tool description',
@@ -25,7 +25,7 @@ def trigger(self, event):
2525
print ("{0:12} {1:45} {2}".format(name,
2626
tools[name]['description'],
2727
keys))
28-
print ('_' * 80)
28+
print ('_' * 80)
2929

3030

3131
# A simple example of copy canvas
@@ -45,15 +45,19 @@ def trigger(self, event):
4545
clipboard.set_image(pb)
4646

4747

48+
49+
50+
4851
fig = plt.figure()
4952
plt.plot([1, 2, 3])
5053

5154
# Add the custom tools that we created
5255
fig.canvas.manager.navigation.add_tool('List', ListTools)
5356
if matplotlib.rcParams['backend'] == 'GTK3Cairo':
5457
fig.canvas.manager.navigation.add_tool('copy', CopyToolGTK3)
55-
#
56-
# Just for fun, lets remove the forward button
57-
fig.canvas.manager.navigation.remove_tool('forward')
58+
59+
# # Just for fun, lets remove the forward button
60+
# fig.canvas.manager.navigation.remove_tool('forward')
61+
5862

5963
plt.show()

0 commit comments

Comments
 (0)