Sorry to reply to myself, but here is a refinement and examples from 
some more brainstorming.

Jason Grout wrote:

> command.  I think William's idea is the way to go: make the variable 
> equal to a slider in the front end and make that variable local to one 
> input cell.  The only way to change the variable would be to move the 
> slider in the front end.  You could use the variable (read only) in SAGE 
> commands.  When a command is typed into the notebook, the notebook first 
> substitutes in any widget variables, and then passes the computation 
> back to Sage to compute.  Doing things this way (keeping the widget 
> variables only in the interface) avoids the much more difficult task of 
> basically implementing the Dynamic command using our current setup.

First, I think that any variable bound to an interactive widget ought to 
be local to the cell and should be treated as read-only in the cell 
code.  This avoids the problem of updating the menu to reflect the 
current value of the variable if it is changed in the code or in another 
cell.  Would it be easy to make a variable local to a cell?

Here is another example of another syntax and the steps that should happen.

{{{
Menu("func",[sin,cos,tan])
plot(func(x)).show()
}}}

would:

1. Create a variable (local to the cell) named func and somehow store 
the list [sin,cos,tan] (we'll call the list "values" here) and do:
sage: func=values[0]

2. Output the HTML needed to render a dropdown menu with the items of 
values as the choices (sin, cos, tan).  The HTML code would include the 
necessary AJAX stuff to execute "func=values[i]" and reevaluate the cell 
if the selection was changed to the ith option.

3. Evaluate the rest of the cell.

Thoughts?  Is this "easy" to implement?

-Jason


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to