tvtk conflict with compiz

I tried the following simple tvtk example but it kept hang my ubuntu 8.10 machine.

#!/usr/bin/env python

from enthought.tvtk.api import tvtk
cs=tvtk.ConeSource(resolution=100)
mapper=tvtk.PolyDataMapper(input=cs.output)
actor=tvtk.Actor(mapper=mapper)
#create a renderer:
renderer=tvtk.Renderer()
# create a render window and hand it the renderer
render_window = tvtk.RenderWindow(size=(400,400))
render_window.add_renderer(renderer)

#dreate interactor and hand it the render window
# this handles mouse interaction with window
interactor=tvtk.RenderWindowInteractor(render_window=render_window)
renderer.add_actor(actor)
interactor.initialize()
interactor.start()

It turns out that compiz is the trouble maker.  The script will work if I switch back to metacity. This can be done by pressing ALT-F2 and then typing

 metacity --replace

Just a side note, the code should be run in ipython with option -wthread.

Leave a Reply

Your email address will not be published. Required fields are marked *