<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Feb 27, 2014 at 4:23 PM, Doug Blank <span dir="ltr"><<a href="mailto:doug.blank@gmail.com" target="_blank">doug.blank@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">
<div class="">On Thu, Feb 27, 2014 at 4:11 PM, Darren Dale <span dir="ltr"><<a href="mailto:dsdale24@gmail.com" target="_blank">dsdale24@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">

Do you have an example of this? I tried in one of the widget example notebooks and couldn't figure out how to change the default value.</div></div></div></blockquote><div><br></div></div><div>You can just the value of the property [1], such as:</div>

<div><br></div><div><pre style="padding:0px;font-family:Monaco,Menlo,Consolas,'Courier New',monospace;font-size:13px;color:rgb(51,51,51);border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:4px;border-bottom-left-radius:4px;margin-top:0px;margin-bottom:0px;line-height:20px;word-break:break-all;word-wrap:break-word;white-space:pre-wrap;background-color:transparent;border:none">
<span>mywidget</span><span style="color:rgb(102,102,102)">.</span><span>value</span> <span style="color:rgb(102,102,102)">=</span> <span style="color:rgb(102,102,102)">25.0</span></pre>
</div><div><br></div><div>and the widget will be set to that value.</div><div><br></div></div></div></div></blockquote><div><br></div><div>Or give it in the constructor, as in "Item A":</div><div><br></div><div>
<pre style="padding:0px;font-family:Monaco,Menlo,Consolas,'Courier New',monospace;font-size:13px;color:rgb(51,51,51);border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:4px;border-bottom-left-radius:4px;margin-top:0px;margin-bottom:0px;line-height:20px;word-break:break-all;word-wrap:break-word;white-space:pre-wrap;background-color:transparent;border:none">
<span class="">mysecondwidget</span> <span class="" style="color:rgb(102,102,102)">=</span> <span class="">widgets</span><span class="" style="color:rgb(102,102,102)">.</span><span class="">RadioButtonsWidget</span><span class="">(</span><span class="">values</span><span class="" style="color:rgb(102,102,102)">=</span><span class="">[</span><span class="" style="color:rgb(186,33,33)">"Item A"</span><span class="">,</span> <span class="" style="color:rgb(186,33,33)">"Item B"</span><span class="">,</span> <span class="" style="color:rgb(186,33,33)">"Item C"</span><span class="">],</span> <span class="">value</span><span class="" style="color:rgb(102,102,102)">=</span><span class="" style="color:rgb(186,33,33)">"Item A"</span><span class="">)</span></pre>
</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra">
<div class="gmail_quote"><div></div><div>Hope that helps!</div><div><br></div><div>-Doug</div><div><br></div><div>[1] - <a href="http://nbviewer.ipython.org/github/ipython/ipython/blob/7eac82e16e9c0c9f8e232816560963a7a07d79d1/examples/widgets/Part%201%20-%20Basics.ipynb" target="_blank">http://nbviewer.ipython.org/github/ipython/ipython/blob/7eac82e16e9c0c9f8e232816560963a7a07d79d1/examples/widgets/Part%201%20-%20Basics.ipynb</a><br>

</div><div><div class="h5"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra">

<div><div><div class="gmail_quote">
<br></div><div class="gmail_quote">On Thu, Feb 27, 2014 at 3:45 PM, Brian Granger <span dir="ltr"><<a href="mailto:ellisonbg@gmail.com" target="_blank">ellisonbg@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">


Yes, for now the right answer is to set the value attribute of the<br>
slider when you construct it. If you are using interact, you can<br>
change the default value for the widget by changing the keyword<br>
argument in the function def.<br>
<div><div><br>
On Thu, Feb 27, 2014 at 11:57 AM, Thomas Kluyver <<a href="mailto:takowl@gmail.com" target="_blank">takowl@gmail.com</a>> wrote:<br>
> Hi Darren,<br>
><br>
> On 27 February 2014 11:37, Darren Dale <<a href="mailto:dsdale24@gmail.com" target="_blank">dsdale24@gmail.com</a>> wrote:<br>
>><br>
>> However, I have a question about portions of the analysis that would<br>
>> require user interaction via a widget. Suppose I start from an ipynb<br>
>> template which includes a slider that defaults to 25. My particular dataset<br>
>> requires the slider to be set to 30. Is it possible for an ipynb widget to<br>
>> save its most recent value as the new default value for the next time the<br>
>> notebook is run? This would be a game-changer for developing user interfaces<br>
>> for scientific applications.<br>
><br>
><br>
> We haven't yet worked out how to save widgets, so they disappear entirely<br>
> when you reload a notebook. We'll get to that for 3.0, and I imagine then<br>
> that the latest value of a slider will be saved with the notebook.<br>
><br>
> However, if you re-run the cell, I think it will (and should) always return<br>
> the default to what the code specifies. I think it's important that running<br>
> code has a predictable result. But I don't think this is a problem: if you<br>
> want the default to be 30, just set it to 30 in your code.<br>
><br>
> Best wishes,<br>
> Thomas<br>
><br>
</div></div>> _______________________________________________<br>
> IPython-dev mailing list<br>
> <a href="mailto:IPython-dev@scipy.org" target="_blank">IPython-dev@scipy.org</a><br>
> <a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
><br>
<span><font color="#888888"><br>
<br>
<br>
--<br>
Brian E. Granger<br>
Cal Poly State University, San Luis Obispo<br>
<a href="mailto:bgranger@calpoly.edu" target="_blank">bgranger@calpoly.edu</a> and <a href="mailto:ellisonbg@gmail.com" target="_blank">ellisonbg@gmail.com</a><br>
_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org" target="_blank">IPython-dev@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
</font></span></blockquote></div><br></div></div></div></div>
<br>_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org" target="_blank">IPython-dev@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
<br></blockquote></div></div></div><br></div></div>
</blockquote></div><br></div></div>