[IPython-user] TraitsUI and ipython

Dave davbrow at gmail.com
Tue Dec 5 00:09:35 CST 2006

On 12/4/06, Dave <davbrow at gmail.com> wrote:
> The solution is helpful but not ideal for me since, if I recall correctly,
> .edit_traits() does not handle persistant storage.  Also I will need to know
> the GUI context and write my script accordingly.  But avoiding this sort of
> complication is my reason for using TraitsUI since it can
> (almost) effectively hide the event loop and other GUI details from
> polluting my simple-minded script code, as well as the minds of
> future script readers.
> Ideally I would think .configure_traits()  could do it's non-GUI stuff like
> optional storage and typing, check for a wx.App or other appropriate GUI
> context, create one if needed, call .edit_traits() to display the widgets,
> and then update the storage. Temporarily, I migth be able to wrap
> HasTraits, at least for wx.APP checking, to prevent the crash if anyone has
> a suggestion for where to start.  Since it sounds like a TraitsUI issue I
> follow up on enthought-dev for a longer-term solution.
> In simple terms how does ipython and pylab work together today?  If ipyhon
> -wthread creates an wx.App does pylab check for it first?  I'm wondering if
> the approach would work for TraitsUI or if it's considered a short-term (but
> very helpful) hack.
> -- David

Well it seems I should have actually tried working with .edit_traits()
first.  In testing so far .edit_traits(kind='modal') works for me with
ipython, with or without the -pylab  or -wthread flags.  David Morril
had previously suggested that importing from enthought.traits.api
ensures the wx windowing system is ready so perhaps that's why it
works in both cases.  I can get pylab plots as well as modal
configuration windows ad no obvious interference other than the pylab
interactive features being suspended until the config window is
closed.  That's pretty much all I need.

Thanks for the help. It's unfortunate that I can't use the persistent
storage feature this way but otherwise it looks very nice.

-- David

More information about the IPython-user mailing list