4

Embedding Chaco into Qt and Wx seems to be no problem. Does anyone have an example or an idea how to embed Chaco into GTK?

Donal Fellows
  • 133,037
  • 18
  • 149
  • 215
Fookatchu
  • 7,125
  • 5
  • 28
  • 26

1 Answers1

2

I use python with matplotlib. To have a graphic inserted in the GUI, I need a "backend" : http://matplotlib.sourceforge.net/faq/installing_faq.html#backends

Code snippet :

from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as Canvas

Then, instance it (the add_subplot prepares a place for one plot) :

figsn  = matplotlib.pyplot.figure()
ax     = figsn.add_subplot(1,1,1)
canvas = Canvas(figsn)
...
snBox.pack_start(canvas, True, True)
canvas.draw()

So, what I want to say is that you need a "backend" from your package where you may be able to draw into, and that GTK can recognize. It suppose your chaco lib has to be compiled with GTK support. I can not install chaco here today, so please dig that way and let me know what you find !

Louis
  • 2,854
  • 2
  • 19
  • 24