mayavi with graph-tool

Hello all,

I am pretty new to graph-tool and trying it because of the fast speed.
However, it seems that graph-tool cannot work together with mlab in mayavi.

I am basically planning to plot a 3D graph using mlab. But when I import
mlab from mayavi, the program always prints the following warning and then
becomes frozen. I don't know why. Is it the problem of gtk? I just want to
use graph-tool data structure and algorithms

output :

/usr/lib/python2.7/dist-packages/gi/module.py:142: Warning: cannot register
existing type `GtkWidget'
  g_type = info.get_g_type()
/usr/lib/python2.7/dist-packages/gi/module.py:142: Warning: cannot add
class private field to invalid type '<invalid>'
  g_type = info.get_g_type()
/usr/lib/python2.7/dist-packages/gi/module.py:142: Warning:
g_type_add_interface_static: assertion `G_TYPE_IS_INSTANTIATABLE
(instance_type)' failed
  g_type = info.get_g_type()
/usr/lib/python2.7/dist-packages/gi/module.py:142: Warning: cannot register
existing type `GtkBuildable'
  g_type = info.get_g_type()
/usr/lib/python2.7/dist-packages/gi/module.py:142: Warning:
g_type_interface_add_prerequisite: assertion `G_TYPE_IS_INTERFACE
(interface_type)' failed
  g_type = info.get_g_type()
/usr/lib/python2.7/dist-packages/gi/module.py:142: Warning:
g_once_init_leave: assertion `result != 0' failed
  g_type = info.get_g_type()
/usr/lib/python2.7/dist-packages/gi/module.py:146: Warning:
g_type_get_qdata: assertion `node != NULL' failed
  type_ = g_type.pytype

attachment.html (1.77 KB)

This warning indicates you are mixing gtk2 and gtk3. Just so you know, the
import for gtk3 looks like:

    from gi.repository import Gtk

The equivalent for gtk2 looks like this:

    import gtk

I hope that can steer you in the right direction, cheers!

-- Johann <https://sites.google.com/site/theodoregoetz/&gt;

attachment.html (2.93 KB)

This is correct. You cannot mix gtk2 and gtk3 in the same program.

If you don't need to use the drawing routines of graph-tool, you can
avoid importing gtk3 by not importing anything from the graph_tool.draw
module.

Simply avoid doing "from graph_tool.all import *" and import only the
submodules you need.

Best,
Tiago

Thanks you! That solved the problem.

BTW, I never use "from graph_tool.all import *", instead I use "import
graph_tool.all as gt", which also caused the above problem.

Can the draw module in graph_tool plot 3d graph and simply interactively
view it ? I can only find 2d examples in the doc. That's why I turned to
mayavi

2015-04-20 1:56 GMT+08:00 Tiago de Paula Peixoto <tiago(a)skewed.de>:

attachment.html (1.8 KB)

There is not 3D drawing at the moment.

Best,
Tiago