On Wed, Jan 30, 2013 at 9:29 PM, Jason Grout
<jason-s...@creativetrax.com> wrote:
> On 1/30/13 10:53 PM, William Stein wrote:
>>
>> On Wed, Jan 30, 2013 at 7:49 PM, Nicolas M. Thiery
>> <nicolas.thi...@u-psud.fr> wrote:
>>>
>>>          Hi William!
>>>
>>> On Wed, Jan 30, 2013 at 05:33:57PM -0800, William Stein wrote:
>>>>
>>>> Can I ask one quick question?  This is *NOT* meant to be a rhetorical
>>>> question (though it could incorrectly be taken that way).  Why did you
>>>> not write this as an interact?
>>>
>>>
>>> The main reason is that we are not serious notebook users; so even if
>>> we did write a couple small interacts, this is not our natural reflex
>>> :-) Another reason is that we wanted something as simple as possible
>>> that would "behave like" the lmfdb; i.e. a standalone web app.
>>>
>>> That being said, having explorer cells in the notebook (or even in a
>>> single-cell using the single-cell server) definitely sounds natural,
>>> as well as using interacts for this.
>>>
>>>> I think with a few small additions to interact (maybe the kinds I
>>>> just did in my re-implementation of interact over the weekend for
>>>> salvus), this would be pretty easily done using interact.
>>>
>>>
>>> I just had a deeper look at the current interact code. The main
>>> feature I feel I am missing to implement an "interact-based" Sage
>>> Explorer is how to change the list of controls, and not only the
>>> output zone, each time an interaction occurs (here there is basically
>>> one per method of the object being explored). If this is possible, A
>>> small example would be most welcome!
>>
>>
>> This is not possible with the Sage notebook.   However,
>> coincidentally, it is exactly the main feature I added to interacts
>> when re-implementing them in Salvus.   In Salvus, you'll be able to do,
>> e.g..,:
>>
>>
>> @interact
>> def f(n=10):
>>      interact.m = n*2
>>
>> and (1) it will automatically create a control for m, and (2) set it
>> to the value 2*n.
>> In general, you can set control values and create controls by
>> assigning to interact.[name],
>> and you can remove controls by doing "del interact.m".
>
>
> What if you then try to change the value of the m control (or can you change
> the value of the m control)?

It's a normal control at that point -- it sends a message back to the
server and calls the function f.
One thing is that it does *not* try to pass m into f.   The interact
object can tell you which variable(s)
triggered a called, and of course you can get their values with
"interact.<var name>".
To tell what triggered a call, do "interact.changed()".

 >Or are these automatically created things more
> like read-only display widgets than "controls" (i.e., controlling
> something)?

No.  They are full controls.

> Nicolas, you can also do this in the current sage cell server, though the
> notation is a little more difficult than William's proposal. Basically, you
> can have nested interacts, and you can give a list of controls to any
> interact call, like
>
> @interact(controls=[('controlname', control_default), ('nextcontrolname',
> next_control_default)])
> def f(**kwd):
>     print kwd
>
> Here's a short example
>
> http://aleph.sagemath.org/?q=3d3b3f6b-a3a9-4619-927d-fd5c1afb526c&lang=sage
>
> The control defaults passed to the controls parameter is processed the same
> as control defaults in the function.
>
> Thanks,
>
> Jason
>
>
>
>
>
>
>
>
>
>
>>
>>   -- William
>>
>>
>>>
>>>> I note "The two authors are unlikely to lead further development of
>>>> this tool," below, and think perhaps the best next step would be to
>>>> take the same idea (and most of the same code), but done in the
>>>> context of an enhanced interact command.
>>>
>>>
>>> Yup. Ideally only the rendering part would change and the rest of the
>>> code base would remain identical, so that it could also be used in a
>>> standalone app like now.
>>>
>>> Cheers,
>>>                                  Nicolas
>>> --
>>> Nicolas M. ThiƩry "Isil" <nthi...@users.sf.net>
>>> http://Nicolas.Thiery.name/
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "sage-devel" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an
>>> email to sage-devel+unsubscr...@googlegroups.com.
>>> To post to this group, send email to sage-devel@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/sage-devel?hl=en.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>
>>
>>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-devel@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-devel?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



-- 
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to