Thank you for the quick response, kcrisman!

On Sep 1, 10:34 am, kcrisman <kcris...@gmail.com> wrote:
> Hi HMark,
>
> I don't think we can currently have controls depending on other
> controls, but there is a ticket for this.  Is this what you are asking
> about? Unfortunately, our trac server for such things is currently a
> little wacky, so I can't tell you where to look.
>

I'm not necessarily looking for a way for one control to depend on
another, but rather for a way for my Python code to modify the state/
condition/rendering of a control (maybe it's the same thing?).

Rado Kirov's graph_editor() is in the direction as far as I can tell
(I'll try to get his code), but it seems to be a "self-contained" or
"monolithic control" i.e., I don't see a way to have my/any Python
code interact/extend/interface with it as part of a larger
"application".

> As to examples of other things, Rado Kirov's graph_editor() *only*
> runs in the notebook for now, and is a nice example of what is
> possible in the notebook.  I hope this helps!
>
> - kcrisman


In the Sage docs (e.g., the interact page at
http://sagemath.org/doc/reference/sagenb/notebook/interact.html), I
see things (apologies for the ignorance, but what are "decorators"?)
like "sagenb.notebook.interact.Slider()", "default_position()",
"render()", etc. I'm totally missing the point of how/where they can
be used, but is this maybe the way to construct "custom GUIs" in the
web browser, and have the Python code directly interact with the
rendered controls through code?

Again, any examples and pointers (flashlights?) to illuminate these
points are greatly appreciated.

HMark.



>
> On Sep 1, 12:21 pm, HMark <myh9...@gmail.com> wrote:
>
> > Hi,
>
> > I have started using sage a short while ago, after playing with
> > Mathematica for a while, and I'm impressed!
>
> > One thing I'm missing is a way to change interact widget rendering in
> > the browser, from within the code.
>
> > So, in the simple example athttp://www.sagenb.org/home/pub/2409/(and
> > also below), what I'd like to see is that the n_points_local input_box
> > widget (in this case, but other types of widgets in general) gets
> > updated every time a new point is added, and n_points_global and
> > n_points_local get modified.
>
> > Similarly, the code changesthe stateof the point_operation buttons
> > to 'Reset' after every time a point is added, but the button widgets
> > rendering doesn't reflect that.
>
> > 1. is there a way to do this with the built-in functionality, or do I
> > need to build a custom GUI with widgets rendered outside of @interact
> > (but within the browser)?
>
> > 2. Regardless, are there examples of custom GUIs, rendered in the
> > browser (Notebook), interacting with the sage functionality, I can
> > look at?
>
> > Any pointers would be appreciated.
>
> > # --- global ---
> > display_points = Graphics()
> > n_points_global = 5
>
> > for i in range(n_points_global):
> >     display_points += point((round(10 * random(), 0), round(10 *
> > random(), 0)))
>
> > @interact
> > def point_setting(
> >         point_operation = ['Reset', 'Add a point'],
> >         n_points_local = input_box(default = n_points_global, label =
> > 'number of points:', width = 5)
> >     ):
> >     global display_points, n_points_global
>
> >     if point_operation == 'Add a point':
> >         display_points += point((round(10 * random(), 0), round(10 *
> > random(), 0)))
> >         n_points_global += 1
> >         n_points_local = n_points_global
> >         point_operation = 'Reset'
>
> >     print "number of points = ", len(display_points)
> >     show(display_points, xmin = 0, xmax = 10, ymin = 0, ymax = 10)

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

Reply via email to