[IPython-dev] widget.interact
MinRK
benjaminrk at gmail.com
Wed Jun 18 16:34:28 EDT 2014
Use widgets.fixed to fix a value:
i = widgets.interact(init_graph,
a=widgets.BoundedFloatTextWidget(min=0., max=10., value=0.1),
b=widgets.BoundedFloatTextWidget(min=0., max=10., value=0.1),
c=widgets.BoundedFloatTextWidget(min=0., max=10., value=1.),
df=widgets.fixed(mydataframe),
)
On Wed, Jun 18, 2014 at 1:00 PM, William Furnass <will at thearete.co.uk>
wrote:
> Hi, is there a way of using widgets.interact so that it only creates
> widgets for a subset of its arguments? This is handy for where you
> already have a function for which you only want widgets for a few
> params.
>
> Below is an example of what I'd like to be able to do. At present
> interact tries to create a widget from df then cries when it finds
> it's an enormous pandas DataFrame.
>
> Cheers,
>
> Will
>
>
> import matplotlib.pyplot as plt
> %matplotlib inline
> import pandas as pd
> from IPython.html import widgets
> from IPython.display import display
>
> def f1(df, a, b, c):
> # process pandas.DataFrame using parameters a, b and c
>
> def init_graph(df, a, b, c):
> f1(df, a, b, c):
> fig = plt.figure()
> # plot stuff here using the pandas.DataFrame df
>
> init_graph(a, b, c, df)
> i = widgets.interact(init_graph,
> a=widgets.BoundedFloatTextWidget(min=0., max=10., value=0.1),
> b=widgets.BoundedFloatTextWidget(min=0., max=10., value=0.1),
> c=widgets.BoundedFloatTextWidget(min=0., max=10., value=1.))
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140618/7e64de5c/attachment.html>
More information about the IPython-dev
mailing list