Does anyone know if using the blit method from FigureCanvasQTAgg is not
fully supported? I'm having a problem where I'm animating a plot using
the blit method and I click on/activate the window the background of the
figure disappears (axes and line stay visible). I'm not sure if this is
just me (Mac OS X Lion, Qt4 4.8.6, Matplotlib 1.1.0), but the following
code reproduces the error:
###
from PyQt4 import QtGui,QtCore
from matplotlib.figure import Figure
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg
from time import sleep
app = QtGui.QApplication([" "])
f = Figure()
c = FigureCanvasQTAgg(f)
a = f.add_subplot(111)
a.set_title("A Title")
bbox = c.copy_from_bbox(a.bbox)
lines = a.plot([1,2,3],[1,2,3])
c.draw()
c.show()
wait = raw_input("Press a key to continue...")
def update(i):
a.lines[0].set_ydata([i,1,i])
print a.bbox.bounds
c.restore_region(bbox, bbox=a.bbox)
a.draw_artist(a.lines[0])
c.blit(a.bbox)
sleep(1)
app.processEvents()
for i in range(20):
update(i)
wait = raw_input("Press a key to continue...")
###
To see the problem, run the code, watch the plot to make sure its
updating properly, then click on the window to put it in focus/activate
it. I'm hoping that I'm just doing something stupid and its an easy
fix. It seems to work until I click on the window (in Mac OS X Lion
Terminal the window is opened in the background and the Terminal window
stays in focus). Thanks for any help.
-Dave
------------------------------------------------------------------------------
Cloud Computing - Latest Buzzword or a Glimpse of the Future?
This paper surveys cloud computing today: What are the benefits?
Why are businesses embracing it? What are its payoffs and pitfalls?
http://www.accelacomm.com/jaw/sdnl/114/51425149/
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users