From b2199e299a6ca6d866aa6f3d0888499136ead9d6 Mon Sep 17 00:00:00 2001 From: Scott Talbert Date: Tue, 11 Jan 2022 19:55:51 -0500 Subject: [PATCH] plotcanvas: avoid trying to adjust scrollbars if nothing drawn For example, if Clear() is called on a plotcanvas, _adjustScrollbars() will not work, so avoid trying to do it if nothing is drawn currently. --- wx/lib/plot/plotcanvas.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wx/lib/plot/plotcanvas.py b/wx/lib/plot/plotcanvas.py index 763e2c0a..ec799ffe 100644 --- a/wx/lib/plot/plotcanvas.py +++ b/wx/lib/plot/plotcanvas.py @@ -707,7 +707,8 @@ class PlotCanvas(wx.Panel): def _do_update(): self.Layout() - self._adjustScrollbars() + if self.last_draw is not None: + self._adjustScrollbars() wx.CallAfter(_do_update) def SetUseScientificNotation(self, useScientificNotation):