MPL with PyQt: different behavior on Windows vs. Linux

Hi,

I am writing some code for automated testing via GPIB using MPL and PyQt. To simulate automated data collection while debugging the program, I have added a for loop (see below) after reading in a data file that plots each point one by one. When I run the program in Linux, I see each point appear on the canvas one by one as designed, but when I run the same code in Windows, nothing shows up on the canvas during the for loop. Instead, once the loop has completed, all points appear simulataneously. Is there any reason the why calls to canvas.draw() show nothing when run in Windows? I’m really lost on this one and would appreciate it someone can tell me what I’m doing wrong. If you need more info on what I’m doing, please let me know.

Thanks in advance,

Steve

self.data =
loadtxt(‘test_data2.csv’,comments = ‘#’,delimiter = ‘,’,skiprows = 0)

for i in range(0,len(self.data)):
line, = self.plotWidget.canvas.ax.plot([self.data[i,1]], [self.data[i,0]], ‘bo’)
self.plotWidget.canvas.draw()

···

It would help if we could see the whole program. Ie, I assume this is
a pure qt app with no import of pyplot/pylab, but w/o seeing any code
I cannot be sure. Also, check the qt examples at

  http://matplotlib.sourceforge.net/examples/animation/index.html

and see if they work on windows. If so, perhaps you can borrow
inspiration from them. If not, perhaps we need to do something
different for qt/windows animation.

JDH

JDH

···

On Tue, Jun 9, 2009 at 5:17 PM, Steve Nicholes<emailaddress_scn@...9...> wrote:

I am writing some code for automated testing via GPIB using MPL and PyQt.
To simulate automated data collection while debugging the program, I have
added a for loop (see below) after reading in a data file that plots each
point one by one. When I run the program in Linux, I see each point appear
on the canvas one by one as designed, but when I run the same code in
Windows, nothing shows up on the canvas during the for loop. Instead, once
the loop has completed, all points appear simulataneously. Is there any
reason the why calls to canvas.draw() show nothing when run in Windows? I'm
really lost on this one and would appreciate it someone can tell me what I'm
doing wrong. If you need more info on what I'm doing, please let me know.

I have seen similar discrepancies between PyQt4 behavior on linux and windows in a few situations. In my experience, a call to PyQt4.QtGui.qApp.processEvents() is sufficient to force an update in your view.

Darren

···

On Tue, Jun 9, 2009 at 6:17 PM, Steve Nicholes <emailaddress_scn@…9…> wrote:

Hi,

I am writing some code for automated testing via GPIB using MPL and PyQt. To simulate automated data collection while debugging the program, I have added a for loop (see below) after reading in a data file that plots each point one by one. When I run the program in Linux, I see each point appear on the canvas one by one as designed, but when I run the same code in Windows, nothing shows up on the canvas during the for loop. Instead, once the loop has completed, all points appear simulataneously. Is there any reason the why calls to canvas.draw() show nothing when run in Windows?