![]() |
|
#1
|
|||
|
|||
|
Define tick positions for viz.SLIDER
Is there a way to define precise tick positions for a viz.SLIDER GUI element? For example, I want to only let someone move the slider to defined points along a linear space - numpy.linspace(0, 1, 26) - so I can easily get the index for the where the tick is located.
Any assistance is greatly appreciated. Chris |
|
#2
|
|||
|
|||
|
Within the slider callback you can compute the nearest defined point and move the tick to it. Example:
Code:
import viz import vizact viz.go() slider = viz.addSlider(pos=(0.5,0.1,0)) SLIDER_STEPS = 10 def UpdateSlider(pos): val = round(SLIDER_STEPS*pos) / float(SLIDER_STEPS) slider.set(val) vizact.onslider(slider,UpdateSlider) |
|
#3
|
|||
|
|||
|
Thanks. That works as advertised.
|
![]() |
| Tags |
| addslider, numpy |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| positions on animation path | whj | Vizard | 3 | 10-27-2009 02:21 PM |