Ask Your Question

Revision history [back]

Since this functionality has yet to appear explicitly, one solution is to nest interacts. Here's a slider that depends on a slider (live example):

@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):

@interact
def _( n=input_box(10) ):

  @interact
  def _( m=slider(0,n,default=n/2) ):

        show( 'n=', n )
        show( 'm=', m )