ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 18 Jun 2016 23:52:52 +0200Interact: getting a slider to change its rangehttps://ask.sagemath.org/question/9213/interact-getting-a-slider-to-change-its-range/How would I get a slider to change its range when the stuff in the input box before it is changed?
Making two interacts somehow doesn't seem to work...Mon, 06 Aug 2012 11:49:11 +0200https://ask.sagemath.org/question/9213/interact-getting-a-slider-to-change-its-range/Comment by calc314 for <p>How would I get a slider to change its range when the stuff in the input box before it is changed?</p>
<p>Making two interacts somehow doesn't seem to work...</p>
https://ask.sagemath.org/question/9213/interact-getting-a-slider-to-change-its-range/?comment=19267#post-id-19267I understand that "sliders that depend on sliders" is a feature that is coming soon. You can see a sample at: http://interact.sagemath.org/node/15. But, it's not in the standard Sage distribution yet.Mon, 06 Aug 2012 17:53:18 +0200https://ask.sagemath.org/question/9213/interact-getting-a-slider-to-change-its-range/?comment=19267#post-id-19267Answer by paulmasson for <p>How would I get a slider to change its range when the stuff in the input box before it is changed?</p>
<p>Making two interacts somehow doesn't seem to work...</p>
https://ask.sagemath.org/question/9213/interact-getting-a-slider-to-change-its-range/?answer=33848#post-id-33848Since this functionality has yet to appear explicitly, one solution is to nest interacts. Here's a slider that depends on a slider (live [example](http://sagecell.sagemath.org/?z=eJxzyMwrSS1KTC7h5UpJTVOI11DIsy3OyUxJLdIw1DE00FTQtOLl4uVSUHBAKFRQgCrNhSk10MnTAYolluaU2ObpGyF0QUBxRn65hoJ6nq26jkKegiaGRC5IIldBEwC8wCPy&lang=sage)):
@interact
def _( n=slider(1,10) ):
@interact
def _( m=slider(0,n,default=n/2) ):
show( 'n=', n )
show( 'm=', m )
And here's a slider that depends on an input box as per the original question (live [example](http://sagecell.sagemath.org/?z=eJxli00KgCAYRPeCd5hdCkI_y0DwJmFlJORnlFHHryho0ayGeW-Mp-QW2yXOejegESDtad5S08ZDlIWErDnjDDCfCbxu0Ovke7eIQpG6NrtNSVNePS-8-do6xl0gI50pEOQPhBsEyBNBkyXq&lang=sage)):
@interact
def _( n=input_box(10) ):
@interact
def _( m=slider(0,n,default=n/2) ):
show( 'n=', n )
show( 'm=', m )Sat, 18 Jun 2016 23:52:52 +0200https://ask.sagemath.org/question/9213/interact-getting-a-slider-to-change-its-range/?answer=33848#post-id-33848