Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
removing pyplot pylab reference in _gui backend
  • Loading branch information
fariza committed Nov 27, 2013
commit 1f6d86ff821aa3eb2c09c140bbdeb4c4f483ed6b
5 changes: 2 additions & 3 deletions lib/matplotlib/backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -2439,7 +2439,7 @@ def key_press_handler(event, canvas, toolbar=None):

# quit the figure (defaut key 'ctrl+w')
if event.key in quit_keys:
Gcf.destroy_fig(canvas.figure)
canvas.manager.destroy()

if toolbar is not None:
# home or reset mnemonic (default key 'h', 'home' and 'r')
Expand Down Expand Up @@ -2525,10 +2525,9 @@ class FigureManagerBase:
*num*
The figure number
"""
def __init__(self, canvas, num):
def __init__(self, canvas):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could avoid this change to the base API, and thereby avoid quite a few other changes, by changing the num argument to a kwarg with default None. In addition to simplifying the changeset, this would avoid breaking any user-written backends that might be in use.

self.canvas = canvas
canvas.manager = self # store a pointer to parent
self.num = num

self.key_press_handler_id = self.canvas.mpl_connect('key_press_event',
self.key_press)
Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/backends/backend_gtk.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,8 +542,8 @@ class FigureManagerGTK(FigureManagerBase):
"""
def __init__(self, canvas, num):
if _debug: print('FigureManagerGTK.%s' % fn_name())
FigureManagerBase.__init__(self, canvas, num)

FigureManagerBase.__init__(self, canvas)
self.num = num
self.window = gtk.Window()
self.set_window_title("Figure %d" % num)
if (window_icon):
Expand Down
Loading