On Thu, May 21, 2009 at 3:57 AM, Pablo Angulo <pablo.ang...@uam.es> wrote:
>
> Hello:
>
> Correct me if I'm wrong, but there's no way to avoid that an interaction
> is rebuilt after any change in the controls. While I've been able to
> live with that, I was now working in some examples using persistent data
> (code is below), and I'd really love two or three things:

You are correct.  Right now one can't do what you want with controls.  It would
be possible for us to implement it though.  How would you like to
specify that a control
doesn't cause a change?

William

>
> 1)  To choose which controls trigger an update and which ones don't
> 2)  Buttons: very similar to current selectors with the option
> buttons=true, the only difference that no one keeps selected after
> hitting the button.
> 3)  (?) Update values of the controls other than the one the user changed
>
> I find there is room in the interact wiki for some examples using
> persistence: "construct bezier curve introducing the points one by one",
> "place queens in a board and watch the cells in the board that they
> threaten", "play nim against a perfect oponent"... but I'd need at least
> number one above.
>
> I would like to put all the input data, and nothing to happen, and then
> the plot would be rebuilt only after the button is hit. Maybe there's a
> workaround, but I don't see it. Currently I can only do the following,
> which has problems when trying to remove a point, as you will see:
>
> #Idea: add points to a plot one by one, and they stay in the plot
> #you chould also be able to remove them and clear them all
>
> points=[(0,0)]
> curva=plot(sin(x))
> menu=['Restart','Add points','Delete points',]
>
> @interact
> def persistent_example_with_interact( option=selector(menu,
> buttons=True), punto=input_box(default=(1,0)) ):
>    global points
>    print option
>    if option=='Restart':
>        points=[(0,0)]
>    elif option=='Add points':
>        points.append(points)
>    else:
>        points.remove(points)
>    print points
>    plot_points=[point2d(p,pointsize=30,rgbcolor=hue(random())) for p in
> points]
>    show(sum(plot_points),aspect_ratio=1,xmin=-2,xmax=2,ymin=-2,ymax=2)
>
>
> >
>



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

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to