У меня есть холст фигуры в ScrolledPanel на панели. Я хочу изменить размер рисунка холста. Например.
mplFigure.set_figheight(1.0)
someobject.soSomethingThatResizeItAll
Как я могу это сделать?
Спасибо
David
Вот мой строительный код.
panel = wx.Panel(self) # we put the scrollablePanel in the panel so later on we can do fit to window sizing too (i.e. by removing the scrollablePanel)
# create a scrollablePanel to hold the canvas
scrollablePanel = ScrolledPanel(parent=panel, id=wx.ID_ANY, name="scrolledPanel", style=wx.ALWAYS_SHOW_SB)
scrollablePanel.SetupScrolling()
scrollablePanel.SetBackgroundColour(wx.Colour(128,128,128))
# create mpl canvas and figure
mplFigure = Figure(figsize=A6H, facecolor="white") #, edgecolor="black")
mplFigureCanvas = FigureCanvasWxAgg(parent=scrollablePanel, id=wx.ID_ANY, figure=mplFigure)
#mplFigureCanvas.SetWindowStyle=wx.SIMPLE_BORDER # not sure if this will have any affect?
#mplFigureCanvas.SetBackgroundColour(wx.Colour(0,0,0))
# center the FigureCanvas inthe scrollablePanel
sizer1 = wx.BoxSizer(wx.VERTICAL)
sizer1.Add(mplFigureCanvas, proportion=0, flag=wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, border=8)
sizer2 = wx.BoxSizer(wx.HORIZONTAL)
sizer2.Add(sizer1, proportion=1, flag=wx.ALIGN_CENTER_VERTICAL)
scrollablePanel.SetSizer(sizer2)
# create mpl toolbar
#mplToolbar = NavigationToolbar2Wx(mplFigureCanvas)
#mplToolbar.Realize() # needed to support Windows systems
# use another sizer to add the scrollablePanel to the main panel
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(scrollablePanel, 1, wx.LEFT | wx.EXPAND)
#sizer.Add(mplToolbar, 0, wx.LEFT | wx.EXPAND)
#mplToolbar.Show()
panel.SetSizer(sizer)