Ask Your Question
1

couple sliders on checkbox click

asked 2011-11-18 05:10:59 +0100

Xtux gravatar image

Consider the following example:

@interact
def _(a=slider(0,10,1,default=2),b=slider(0,10,1,default=5),equal=checkbox(False)):
    a=2

Is it possible, that after clicking on the checkbox, the position of the second slider becomes equal to that of the first slider and that, as long as the checkbox is checked, both sliders are coupled, i.e. if you change one, the other one changes by the same value.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2011-11-18 05:22:58 +0100

Jason Grout gravatar image

There's not an easy way to lock the sliders, though you could easily ignore one of the sliders if the checkbox was checked.

@interact
def _(a=slider(0,10,1,default=2),b=slider(0,10,1,default=5),equal=checkbox(False)):
    if equal:
        b=a
    print a, b
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2011-11-18 05:10:59 +0100

Seen: 308 times

Last updated: Nov 18 '11