使用Igraph的交互式UI [英] Interactive UI with Igraph

查看:274
本文介绍了使用Igraph的交互式UI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何工具可以帮助我创建一个交互式用户界面,以使用iGraphs for python生成图形? 例如,我可以将pyQt和Igraph一起使用吗?

Is there any tool which helps me create an interactive user interface for generating graphs using iGraphs for python? For instance can I use pyQt along with Igraph?

推荐答案

igraph的Python接口使用Cairo作为绘图后端,因此它可以在Cairo支持的任何表面上绘制图形.似乎其他人已经设法将igraph的绘图表面连接到gtk.DrawingArea,因此,如果您使用的是PyGtk,则这是一种可能性.

The Python interface of igraph uses Cairo as the drawing backend, so it can draw graphs on any surface that Cairo supports. It seems like someone else has managed to connect igraph's drawing surface to a gtk.DrawingArea, so that's one possibility if you are using PyGtk.

对于PyQt和其他绘图工具包,我不确定,但是解决方案可能类似于在PyGtk中使用gtk.DrawingArea完成的工作;基本上,您是从图形工具包中继承画布小部件,获取原始存储块的句柄,图形工具包在其中绘制画布的内容,然后将该存储块包装在具有适当宽度,高度和位深度的cairo.ImageSurface中,然后要求igraph通过构造使用该表面的igraph.drawing.Plot对象在该表面上绘制.抱歉,无法提供更具体的信息,但这实际上取决于您计划使用的确切图形工具包,而我对PyGtk或PyQt不太熟悉.

As for PyQt and other drawing toolkits, I'm not sure but the solution is probably similar to what has been done with the gtk.DrawingArea in PyGtk; basically you subclass a canvas widget from your graphics toolkit, obtain a handle to the raw memory block where the contents of the canvas is drawn by the graphics toolkit, wrap that memory block in a cairo.ImageSurface with the appropriate width, height and bit depth, and then ask igraph to draw onto that surface by constructing an igraph.drawing.Plot object that uses the surface. Sorry for not being able to be more specific, but it really depends on the exact graphics toolkit that you plan to use, and I'm not too familiar with either PyGtk or PyQt.

这篇关于使用Igraph的交互式UI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆