This makes sense to me, Jason.
As long as there is a way to:
- indicate which interactive control (i.e., not just buttons/
selectors, but also input_boxes, checkboxes, etc.) can trigger an
update/evaluation
- indicate which values of which controls should be sent for
evaluation
- allow for a single change in a single control to trigger an
evaluation (like it's currently done, where any change is a trigger)
I think it'll satisfy most (all?) requirements.
Related to this, I think it'd be quite useful to enable the Python
code to "write" and modify the control values (so, going both
directions: from code to controls, not just from controls to code).
This can be a step in making interact a mechanism for creating "custom
GUIs", which I think would be of great benefit in educational
scenarios, where some of the Sage math syntax/complexity may be hidden
behind the GUI to lower the barrier of entry for novices/students as
they explore/learn new math concepts.
Hope it makes sense.
Thanks,
HMark.
On Jul 1, 3:34 pm, Jason Grout <[email protected]> wrote:
> On 7/1/11 4:35 PM, HMark wrote:
>
>
>
> > Thank you for the quick reply, Jason.
>
> > So if I understand your proposed solution, then in the following case,
> > you'll be able to specify that when any of the operations buttons is
> > clicked, BOTH sliders n1 and n2 will be read and sent to the server,
> > if the syntax is modified, and the checkbox, unless qualified with an
> > update, will behave as it currently does?
>
> > ------------------- original ----------------------
> > @interact
> > def logarithmic_ops(
> > n1 = slider(1, 10, 0.5, 4.0, label='n1:'),
> > n2 = slider(1, 10, 0.5, 5.0, label='n2:'),
> > operation = ['Reset', 'Multiply', 'Divide'],
> > show_linear_ruler = checkbox(default=false, label='Show
> > linear ruler:')
> > ):
>
> > ------------ modified ----------------------
> > @interact
> > def logarithmic_ops(
> > n1 = slider(1, 10, 0.5, 4.0, label='n1:', update=False),
> > n2 = slider(1, 10, 0.5, 5.0, label='n2:', update=False),
> > operation = button(['Reset', 'Multiply', 'Divide'],
> > update=['n1', 'n2']),
> > show_linear_ruler = checkbox(default=false, label='Show
> > linear ruler:')
> > ):
>
> > This approach could work, assuming that it will be applicable to ALL
> > other controls, not just button, like for example:
>
> > @interact
> > def point_setting(
> > n_points_i = input_box(default = 4, label = 'number of points:',
> > width = 5, update=False),
> > user_slope = input_box(default = 0, label = 'Your estimated
> > slope:', width = 5, update=False),
> > user_offset = input_box(default = 0, label = 'Your estimated
> > offset:', width = 5, update=['n_points_i', 'user_slope']),
> > show_calculations = checkbox(default = false, label = 'Show least
> > squares calculations:'),
> > show_best_fit = checkbox(default = false, label = 'Show best
> > fit:')
> > ):
>
> > where only when user_offset is modified, does it grab the values of
> > n_points_i and user_slope and sends it to the server for evaluation.
>
> > Hope it makes sense, and definitely appreciate the effort!
>
> Yes, you have the idea behind the current direction. Any suggestions?
>
> Thanks,
>
> Jason
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org