Small modification in the GUI.
epsi-builds/msspec_python3/pipeline/head There was a failure building this commit Details

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.
This commit is contained in:
Sylvain Tricot 2020-11-09 14:24:08 +01:00
parent fac18395c4
commit 1bd1c0a9ce
1 changed files with 8 additions and 3 deletions

View File

@ -80,6 +80,7 @@ import numpy as np
import wx.grid import wx.grid
from lxml import etree from lxml import etree
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas 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_agg import FigureCanvasAgg
from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg
from matplotlib.figure import Figure from matplotlib.figure import Figure
@ -1084,7 +1085,8 @@ class _DataWindow(wx.Frame):
for dset in self.data: for dset in self.data:
nb = wx.Notebook(self, -1) nb = wx.Notebook(self, -1)
self.notebooks[dset.title] = nb 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(): for view in dset.views():
self.create_page(nb, view) self.create_page(nb, view)
@ -1273,10 +1275,12 @@ class _DataWindow(wx.Frame):
toolbar = NavigationToolbar2WxAgg(canvas) toolbar = NavigationToolbar2WxAgg(canvas)
toolbar.Realize() 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() 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.SetSizer(sizer)
p.Fit() p.Fit()
@ -1287,6 +1291,7 @@ class _DataWindow(wx.Frame):
figure.canvas.mpl_connect('pick_event', self.on_mpl_pick) figure.canvas.mpl_connect('pick_event', self.on_mpl_pick)
nb.AddPage(p, view.title) nb.AddPage(p, view.title)
canvas.draw()
def OLDcreate_page(self, nb, view): def OLDcreate_page(self, nb, view):