开发者

Embedding chaco in GTK

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?


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 !

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜