Skip to content

Commit 0665890

Browse files
committed
using navigation as signal handler
1 parent a2ed47f commit 0665890

File tree

4 files changed

+272
-198
lines changed

4 files changed

+272
-198
lines changed

examples/user_interfaces/navigation.py

+3-7
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class ListTools(ToolBase):
1212
keymap = 'm'
1313
description = 'List Tools'
1414

15-
def trigger(self, event):
15+
def trigger(self, *args, **kwargs):
1616
tools = self.navigation.get_tools()
1717

1818
print ('_' * 80)
@@ -36,7 +36,7 @@ class CopyToolGTK3(ToolBase):
3636
# It is not added to the toolbar as a button
3737
intoolbar = False
3838

39-
def trigger(self, event):
39+
def trigger(self, *args, **kwargs):
4040
from gi.repository import Gtk, Gdk
4141
clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
4242
window = self.figure.canvas.get_window()
@@ -45,9 +45,6 @@ def trigger(self, event):
4545
clipboard.set_image(pb)
4646

4747

48-
49-
50-
5148
fig = plt.figure()
5249
plt.plot([1, 2, 3])
5350

@@ -56,8 +53,7 @@ def trigger(self, event):
5653
if matplotlib.rcParams['backend'] == 'GTK3Cairo':
5754
fig.canvas.manager.navigation.add_tool('copy', CopyToolGTK3)
5855

59-
# # Just for fun, lets remove the forward button
56+
# Uncomment to remove the forward button
6057
# fig.canvas.manager.navigation.remove_tool('forward')
6158

62-
6359
plt.show()

0 commit comments

Comments
 (0)