I'm trying to make a PlotWidget moving (from left to right) really fast like if it was an electrocariogram. Here's an example of what i want (except that he used PyQwt (which is incompatible with my projet because I use PySide (and not PyQt) and also except that I want the X axis to move from left to right too) :
However, I have no idea how to do it. I can plot the grab, i can make it move from left to right using the method :
myPlotWidget.setXRange(0, 100)
then
myPlotWidget.setXRange(1, 101)
Which made it looks like it moved from left to right (of 1 unit) but I don't now how to make it smooth and automatic. I tried to make a loop which looks like this :
for i in range(1000):
myPlotWidget.setXRange(10+i, 100+i, update=True)
But during the loop the plot is not updated... The plot is only updated when the loop is over, so I cannot see it "moving" from left to right, I just have the final result.
Someone can help me on this? Is there any way I can force the redraw the 1000 times of the loop?
I was first thinking it was computing too fast so I tried this
for i in range(1000):
myPlotWidget.setXRange(10+i, 100+i, update=True)
time.sleep
but of course it didn't work.
Thank you so much for your help !