DISABLE ADBLOCK

ADBlock is blocking some content on the site

ADBlock errore

Question

I know it's possible to place a PyCairo surface inside a Gtk Drawing Area. But I think Qt is a lot better to work with, so I've been wondering if there's anyway to place a PyCairo surface inside some Qt component?

Solution

Qt's own OpenGL based surfaces (using QPainter) are known to be much faster than Cairo. Might you explain why you want specifically Cairo in Qt?

For the basics of using QPainter see this excerpt from the book "C++ GUI Programming with Qt4", and while it's C++ code, the PyQt implementation will be parallel.

As for joining Cairo with Qt... This article in ArsTechnica sheds some light - it seems nothing that could help you exists currently (iow., nobody tried such marriage).

OTHER TIPS

For plotting with you should also consider matplotlib, which provides a higher level API and integrates well with PyQT.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow