From 1bd1c0a9ce96328a2cb684c0d3f20ac8cd679dd4 Mon Sep 17 00:00:00 2001 From: Sylvain Tricot Date: Mon, 9 Nov 2020 14:24:08 +0100 Subject: [PATCH] Small modification in the GUI. The automatic resizing is not working very well in WXPython along with matplotlib with the WxAgg backend. It is an attempt to improve this but does not change anything unfortunately. This is a problem of WX + mpl. --- src/msspec/iodata.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/msspec/iodata.py b/src/msspec/iodata.py index 3308cb5..998485b 100644 --- a/src/msspec/iodata.py +++ b/src/msspec/iodata.py @@ -80,6 +80,7 @@ import numpy as np import wx.grid from lxml import etree from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas +#from matplotlib.backends.backend_wxagg import FigureCanvasWx as FigureCanvas from matplotlib.backends.backend_agg import FigureCanvasAgg from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg from matplotlib.figure import Figure @@ -1084,7 +1085,8 @@ class _DataWindow(wx.Frame): for dset in self.data: nb = wx.Notebook(self, -1) self.notebooks[dset.title] = nb - self.GetSizer().Add(nb, 1, wx.ALL|wx.EXPAND) + #self.GetSizer().Add(nb, 1, wx.ALL|wx.EXPAND) + self.GetSizer().Add(nb, proportion=1, flag=wx.ALL|wx.EXPAND) for view in dset.views(): self.create_page(nb, view) @@ -1273,10 +1275,12 @@ class _DataWindow(wx.Frame): toolbar = NavigationToolbar2WxAgg(canvas) toolbar.Realize() - sizer.Add(toolbar, 0, wx.ALL|wx.EXPAND) + #sizer.Add(toolbar, 0, wx.ALL|wx.EXPAND) + sizer.Add(toolbar, proportion=0, flag=wx.ALL|wx.EXPAND) toolbar.update() - sizer.Add(canvas, 5, wx.ALL|wx.EXPAND) + #sizer.Add(canvas, 5, wx.ALL|wx.EXPAND) + sizer.Add(canvas, proportion=1, flag=wx.ALL|wx.EXPAND) p.SetSizer(sizer) p.Fit() @@ -1287,6 +1291,7 @@ class _DataWindow(wx.Frame): figure.canvas.mpl_connect('pick_event', self.on_mpl_pick) nb.AddPage(p, view.title) + canvas.draw() def OLDcreate_page(self, nb, view):