Kevin Horton wrote:
I'm trying to build an app that will put many (between 10 and 38) matplotlib plots in a panel that scrolls vertically. I have a pyGTK app that does this very well, but I want to switch to wxPython, if possible. I find that scrolled panels created with wx.ScrolledWindow and the new wx.lib.scolledpanel scroll very, very slowly once I put several matplotlib plots in them. I'm not sure if this is because I'm doing something wrong, or if it is just poor performance in wxPython. The exact same task in pyGTK scrolls very quickly, so I don't think it is some inherent weakness in OS X, python, or in matplotlib.
I'm running wxPython 2.8.3.0 with python 2.5 on a 1.33 GHz G4 PowerBook running OS X 10.4.9.
I haven't put in any code yet to handle scrolling when you click the arrows at the ends of the scrollbars, but you can see slow scolling if you grab the scrollbar and move it.
Is there something I can do to speed things up, or should I just give up on wxPython and go back to pyGTK?
Does a similar app without matplotlib exhibit the same slowness?
import wx
import wx.lib.scrolledpanel as SP
bgc = ['white', 'black', 'light blue', 'light green', 'pink', 'brown',
'yellow', 'orange', 'navy', 'red', 'purple']
class App(wx.App):
def OnInit(self):
self.frame = wx.Frame(parent = None,
title = 'Scrollbar Example', size=(800, 600))
self.panel = SP.ScrolledPanel(self.frame, -1)
vbox = wx.BoxSizer(wx.VERTICAL)
for c in bgc:
p = wx.Panel(self.panel, style=wx.SUNKEN_BORDER)
p.SetMinSize((640,480))
p.SetBackgroundColour(c)
vbox.Add(p, 0, wx.ALL, 5)
self.panel.SetSizer(vbox)
self.panel.SetupScrolling()
self.frame.Show()
return True
if __name__ == '__main__':
app = App(redirect = False)
app.MainLoop()
···
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!