[IPython-dev] Feasilibity of widgets/layout for mimicking this
fperez.net at gmail.com
Wed Aug 20 19:07:05 EDT 2014
On Wed, Aug 20, 2014 at 3:29 PM, Adam Hughes <hughesadam87 at gmail.com> wrote:
> These widgets would need to accept input data, and return output data.
> For example in the example Nicholas shared, I'd like the user to be able
> to pass in a matrix, calculate the synchronous spectra, and then use that
> for further analysis in subsequent cells in the primary notebook. Having
> that as a capability would be huge for us, because we envision a mixed
> API/GUI workflow.
One option here would be to provide a text field for the user to name the
variables they want returned for any given output (or you can fix those if
you want), and then have your kernel-side code store them in the user's
Here's how you can immediately write variables in ipython:
In : ip = get_ipython()
In : a = 'hello'
In : ip.user_ns['a']
In : ip.user_ns['a'] = 100
In : a
We can think further about whether other paradigms might be cleaner, but
I'm not sure that making variables be the return value of the widget itself
will work all that well. But in the meantime, and until we decide what the
best solution is in the long term, this will already work and it uses a
100% stable IPython api. It may be in the end this *is* a long-term
solution we all like, but even if not, I think it's pretty serviceable.
Fernando Perez (@fperez_org; http://fperez.org)
fperez.net-at-gmail: mailing lists only (I ignore this when swamped!)
fernando.perez-at-berkeley: contact me here for any direct mail
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the IPython-dev