使用Igraph的交互式UI

编程入门 行业动态 更新时间:2024-10-23 14:28:16
本文介绍了使用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

本文发布于:2023-11-10 00:58:53,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1573926.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Igraph   UI

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!