[IPython-user] TraitsUI and ipython

Fernando Perez Fernando.Perez at colorado.edu
Sun Dec 3 22:00:32 CST 2006

Robert, I'm not sure why this bounced coming from you; I just added you to the 
  manual whitelist to avoid problems in the future.

Re: TraitsUI and ipython
Robert Kern <robert.kern at gmail.com>
Sun, 03 Dec 2006 19:03:10 -0600
ipython-user at scipy.net

Dave wrote:
 > > I'm just starting to work with the Enthought Traits module which looks
 > > to have a very handy basic GUI for setting configuration data in
 > > scripts and handling bits of persistent data with a trivial level of
 > > effort.  It seems like it would be a great addition to the
 > > ipython/pylab/YFE (your favotite editor) setup.  However, so far, I
 > > have not been able to get python and pylab to cooperate on OS X.  I'm
 > > using wxpython in pylab.  When I start ipython with -pylab or use
 > > ipython -wthread and then run a TraitUI script the GUI window appears
 > > along with a spinning-disk cursor for several seconds, followed by a
 > > python/wxpython crash.

What are you using to bring up the Traits sheet? .configure_traits() is used for
when the Traits sheet *is* the application; i.e., it should not be used when a
wx.App() has already been created like it is with "ipython -wthread". Use
.edit_traits() instead. I apologize for the near-indistinguishable names;
personally, I'd prefer that .configure_traits() be called

This is what I get (Intel OS X, Python 2.5, "ipython -wthread"
svn-mumble-mumble, wxPython 2.6.3.x, enthought bleeding-svn):

In [1]: from enthought.traits.api import *

In [2]: class Foo(HasTraits):
    ...:     bar = Str

In [3]: f = Foo()

In [4]: f.edit_traits()  # It works!
Out[4]: <enthought.traits.ui.ui.UI object at 0x179f2ea0>

In [5]: f.configure_traits()  # It fails!
Out[5]: False

In [6]: zsh: bus error  ipython -wthread

-- Robert Kern "I have come to believe that the whole world is an enigma, a 
harmless enigma that is made terrible by our own mad attempt to interpret it 
as though it had an underlying truth." -- Umberto Eco

More information about the IPython-user mailing list