My data is like [0, 7, 14]
When writing the code xSlider = Slider(axesX, 'Slug pos X', 0, 14, 0)
When polling the slide, it will show floating value like 0, 0.3, 0.7....13.3, 14 I want to polling the slide value like 0, 7, 14
How should I do?
My data is like [0, 7, 14]
When writing the code xSlider = Slider(axesX, 'Slug pos X', 0, 14, 0)
When polling the slide, it will show floating value like 0, 0.3, 0.7....13.3, 14 I want to polling the slide value like 0, 7, 14
How should I do?
If I understand correctly, you just want to convert the continuous range of the slider (0. to 14.) into three discrete values (0, 7, 14). You can do this with the formula,
i = 7*int(round(x/7))
Which breaks the region into three sections, with the middle corresponding to 7
and the left and right quarters being 0
and 14
.
You could also just use something discrete like radio buttons
.