From b344ab8fbdf7339035ab890d925af6d028625a24 Mon Sep 17 00:00:00 2001 From: Stephen Horst Date: Wed, 28 Jan 2015 13:21:35 -0800 Subject: [PATCH 1/3] Attempting to resize when toolbar has been turned off causes an unhandled exception --- lib/matplotlib/backends/backend_tkagg.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/backends/backend_tkagg.py b/lib/matplotlib/backends/backend_tkagg.py index 8df5f0536916..ced2b69e2686 100644 --- a/lib/matplotlib/backends/backend_tkagg.py +++ b/lib/matplotlib/backends/backend_tkagg.py @@ -562,7 +562,8 @@ def resize(self, width, height=None): else: self.canvas._tkcanvas.master.geometry("%dx%d" % (width, height)) - self.toolbar.configure(width=width) + if self.toolbar is not None: + self.toolbar.configure(width=width) def show(self): """ From 8417f7f462b89a713653df38aef5d36bd445822d Mon Sep 17 00:00:00 2001 From: Stephen Horst Date: Wed, 28 Jan 2015 13:50:18 -0800 Subject: [PATCH 2/3] Propose removing minimum window size limit in tkAgg backend --- lib/matplotlib/backends/backend_tkagg.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/backends/backend_tkagg.py b/lib/matplotlib/backends/backend_tkagg.py index ced2b69e2686..16cfdbfb55a5 100644 --- a/lib/matplotlib/backends/backend_tkagg.py +++ b/lib/matplotlib/backends/backend_tkagg.py @@ -532,7 +532,12 @@ def __init__(self, canvas, num, window): self._num = num _, _, w, h = canvas.figure.bbox.bounds w, h = int(w), int(h) - self.window.minsize(int(w*3/4),int(h*3/4)) + # Is there any need to limit the minimum size of the window? I would + # like to be able to dynamically change the window size of a figure and + # if my window starts out large and I want to go small, this line + # limits me. I'm not seeing the advantage of this limit in the first + # place, so I propose removal. + #self.window.minsize(int(w*3/4),int(h*3/4)) if matplotlib.rcParams['toolbar']=='toolbar2': self.toolbar = NavigationToolbar2TkAgg( canvas, self.window ) else: From 487f8005a3d3088e8126473fd51c437be07c8d23 Mon Sep 17 00:00:00 2001 From: Stephen Horst Date: Wed, 28 Jan 2015 17:53:18 -0800 Subject: [PATCH 3/3] Revert "Propose removing minimum window size limit in tkAgg backend" This reverts commit 8417f7f462b89a713653df38aef5d36bd445822d. --- lib/matplotlib/backends/backend_tkagg.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/matplotlib/backends/backend_tkagg.py b/lib/matplotlib/backends/backend_tkagg.py index 16cfdbfb55a5..ced2b69e2686 100644 --- a/lib/matplotlib/backends/backend_tkagg.py +++ b/lib/matplotlib/backends/backend_tkagg.py @@ -532,12 +532,7 @@ def __init__(self, canvas, num, window): self._num = num _, _, w, h = canvas.figure.bbox.bounds w, h = int(w), int(h) - # Is there any need to limit the minimum size of the window? I would - # like to be able to dynamically change the window size of a figure and - # if my window starts out large and I want to go small, this line - # limits me. I'm not seeing the advantage of this limit in the first - # place, so I propose removal. - #self.window.minsize(int(w*3/4),int(h*3/4)) + self.window.minsize(int(w*3/4),int(h*3/4)) if matplotlib.rcParams['toolbar']=='toolbar2': self.toolbar = NavigationToolbar2TkAgg( canvas, self.window ) else: