Very slow scrolling with multiple plots in window

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!

Kevin Horton wrote:

and the new wx.lib.scolledpanel scroll very, very slowly once I put several matplotlib plots in them.

Are you making one big Figure with lots of subplots? or putting multiple figure panels in one scrolled panel?

If the former, you should be able to make sure that it all gets drawn to one big off-screen bitmap, then scrolling should be very fast.

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.

How'd you get MPL to work with 2.8.3? none of the binaries I know support it out of the box, nor does a simple setup.py build work. In any case, I think only the non-accelerated code works, so that could have something to do with it. The non-accelerated code could be slower n transferring the agg buffer to wx -- so you probably want to make sure that that's not happening with every scroll event.

I haven't put in any code yet to handle scrolling when you click the arrows at the ends of the scrollbars,

huh? doesn't scrolledpanel take care of that for you?

should I just give up on wxPython and go back to pyGTK?

Never!!

I could bring the question up on a matplotlib list, to see if there is some other way I could use it that would put less load on wxPython.

I'll bet there is. Make a small-as-you-can self contained example, and post it on the MPL list, I'll bet you'll get help.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov