[IPython-dev] How to set state of widget in IPython3?
Mark Bakker
markbak at gmail.com
Tue Mar 24 07:51:28 EDT 2015
Hello list. I am trying to set the state of a DropdownWidget (Or
RadioButton) in IPython3. You didn't have to do that in the past, but even
if I specify the value, it gives me an error. Simple example:
This works:
def plot_line(c='b'):
plt.plot([0,1],color=c)
interact(plot_line,c=['b','r','g']);
This works in IPython2, but not in IPython3. In IPython3 it passes c=None
to the function on initialization.
def plot_line(c='b'):
plt.plot([0,1],color=c)
interact(plot_line,c=DropdownWidget(values=['b','r','g']));
Even when specifying the value, for example
def plot_line(c='b'):
plt.plot([0,1],color=c)
interact(plot_line,c=DropdownWidget(value='r',values=['b','r','g']));
I get an error: KeyError: 'r'.
Any thoughts on how to set the state when creating a DropwdownWidget (or
RadioButtonWidget) using interact? Or is this a bug?
Thanks,
Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20150324/a1096dbe/attachment.html>
More information about the IPython-dev
mailing list