Interactive UI with Igraph

余生长醉 提交于 2020-05-17 08:56:08

问题


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?


回答1:


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.

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.



来源:https://stackoverflow.com/questions/17025690/interactive-ui-with-igraph

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!