Log in

View Full Version : Slider Assistance


new_horizon
05-14-2012, 05:17 AM
Hi All,

I'm currently working on incorporating a slider into my work.

A few questions...

1) Is there a way of labelling different areas of the slider for the user? I have already specified the different intervals in the code.

2) Is there a way of outputing the slider value from the code? So in trial 1 for instance, where did the user move the slider to when prompted.

Thanks

Jeff
05-14-2012, 06:48 AM
1) Do you want labels above or below the slider? If so, you can create text objects and position them at those intervals.

2)Register a callback function for the slider event using vizact.onslider:
import viz
viz.go()

slider = viz.addSlider(pos=[0.5,0.5,0])
def sliderChanged( pos ):
print pos
vizact.onslider( slider, sliderChanged )

new_horizon
05-14-2012, 07:30 AM
Hi Jeff,

Thanks for your prompt response.

I have been trying this method and it does not seem to allow me to register the slider position as a variable for an output.

How can I assign the "pos" value to a variable? For instance, "slidepos"?

Thanks

Jeff
05-16-2012, 07:32 AM
I'm not sure I understand the question. Can you post some example code that shows what you are trying to do?