0

Is it possible to use pycairo to draw inside a PySide2 widget? The only examples I have seen where they use pycairo to draw in a windowed application combine pycairo with GTK.

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
HelloGoodbye
  • 3,624
  • 8
  • 42
  • 57
  • You'd need create a qt "surface". Googling for "cairo surface qt" finds [this question](https://stackoverflow.com/questions/1639895/cairo-and-qt-integration). The answers/discussions are interesting (there is an experimental cairo-qt-surface, is this really what you want, ...). Maybe you should see if it helps you go a little further. – Demi-Lune Aug 31 '20 at 15:33
  • Otherwise, you could follow one of the ideas in [Integration with other Libraries](https://pycairo.readthedocs.io/en/latest/integration.html): the pygame example shows how to share the buffer image; the buffer could then be used to make a QImage. Using numpy as a buffer is also a possibility. Are these ideas too low-level for your needs? – Demi-Lune Aug 31 '20 at 15:39

0 Answers0