Jason Grout wrote:
> 
> Hi everyone,
> 
> I've been thinking about how to implement interactive widgets in the 
> notebook.  Things like sliders, buttons, etc., that allow interactivity 
> like Maplets in Maple or the Manipulate command in Mathematica 6. 
> Here's an example of an interface:
> 
> sage: a=Slider(1,10)
> sage: plot(sin(a()*x),-3,3)
> 
> and in the notebook would appear a slider labeled "a" and the graph 
> would appear below it.  As the slider is moved between 1 and 10, the 
> plot updates dynamically, showing the frequency-scaling aspect of 
> different values of a.

Yeah!  It works!! :)

I've put a very alpha patch (against 2.8.13) up on trac #1322 that 
implements the following:


sage: from sage.server.notebook.widgets.menu import menu
sage: menu('f', [sin, cos, tan] ).show()

(a select box menu is shown with sin, cos, and tan as options.  Pick a 
value for f.  And that means that at this point, you really do need to 
pick a value for f that is different from the initial value.)

sage: plot(f(x),0,2*pi).show()

(the plot of f(x) (with the selected f) is shown.)

There is a huge list of disclaimers/todo things in the comments of 
#1322.  However, this initial alpha-quality patch gives an idea of the 
functionality and an idea of how to do it.

Have a great day,

-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