[IPython-dev] Quick Question about Widgets
hughesadam87 at gmail.com
Sat Oct 25 16:58:32 EDT 2014
I just wanted to say that this suggest worked like a charm and we are very
appreciate for your help!
On Mon, Oct 6, 2014 at 4:29 PM, Nicholas Bollweg <nick.bollweg at gmail.com>
> Sorry; haven't had much time to tinker on widget stuff much outside of
> directly work-related stuff.
> The file stuff sounds like it's getting pretty complicated! Maybe you
> could add another layer outside of the GUI, like a Workspace, and have all
> of the file-relevant stuff handled there. Then, when you change datasets,
> you just re-roll the whole GUI related to that specific dataset.
> However, based on what you have done... first, you could instrument the
> dataset as a traitlets.Instance: (*caveat: the below things are not
> class Spectrogram(HTML):
>> ts = Instance(klass=WhateverTsIs)
> Then you can use the nice events to react to that being switched to a new
> instance on a per-linked-widget basis:
> class Spectroscopy(Box):
>> def _sampling(self):
>> start = FloatSlider(
>> description="Slicing Start Value",
>> def _ts_changed(name, old, new):
>> start.value = self.graph.ts.index
>> start.min = self.graph.ts.index.min()
>> start.max = self.graph.ts.index.max()
>> self.graph.on_trait_changed(_ts_changed, "ts")
> Now, you'll probably still have the problem of whether you are actually
> ready to redraw as all those controls re-initialize... the easiest thing
> would probably be to just add some more error handling to Spectrogram.draw
> to catch these errors, and let it fail if you are pretty confident that it
> will work once the inputs are all valid. Or, you could set a time window
> during which you don't try to redraw. Not sure what would work out best.
> Maybe this helps?
> IPython-dev mailing list
> IPython-dev at scipy.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the IPython-dev