>>>>> "Sigve" == Sigve Tjora <pu...@tj...> writes: Sigve> Hi, I have written a basic QtAgg backend for Sigve> Matplot-lib. It is only tested on Windows, so some more Sigve> testing should be done, but it is my hope that it can some Sigve> day be included in the matplotlib distribution. I will test Sigve> on linux when I get the time, but all the code is python so Sigve> it should probably work ok. Indeed -- it's a testament to QT and python that the untested code appears to run the same on linux (per Steve's report) and OS X, which I tested today. Good work! Sigve> See http://www.tjora.no/python/matplotlib/ for the code. Sigve> Most examples run ok, but the keypress_demo.py does not Sigve> work yet. Not all examples have been tested, just some Sigve> random double-clicking on the one that look interesting. I think the problem here was that you had def keyPressEvent(self, ev): self.keyPressEvent(ev.text()) def keyReleaseEvent(self, ev): self.keyReleaseEvent(ev.text()) where you meant def keyPressEvent(self, ev): self.key_press_event(ev.text()) def keyReleaseEvent(self, ev): self.key_release_event(ev.text()) I made these changes in CVS, and the keypress_demo indeed works. Sigve> A lot of the comments from the backend_template.py has not Sigve> been removed or fixed. The code is also somewhat rough Sigve> around the edges, but it works. Sigve> Is there any unittest-suite it is possible to run the Sigve> backend against? The standard test suite is examples/backend_driver. You just need to set the "backends" list to the list of backends you want to test. Eg backends = ['QtAgg'] Sigve> Feedback is welcome. I agree with most of the comments Steve made. * I think factoring the class into a module that handles the qt widgets, and have a small module that does qtagg would be a good thing. Steve would likely do a qtcairo backend if you did this... * The only explanation I can think of for why the colors are wrong is that qt has a different byte order for images than you are getting from agg (is could it be bgra instead of rgba, or that something is wrong with the endianess...) If you need a different byte ordering /pixel format, I can provide the required method in the agg backend. I note that the saved figures *do* have the right color scheme, which supports this idea. * The control key modifier is apparently not recognized -- this provides aspect ratio preserving zoom. I can't test any of the right click drag functionality right now, actually, since I'm on a mac w/o an external mouse plugged in **&$$ macs! Thanks! JDH