WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 01-10-2012, 01:14 PM
hotshotiguana hotshotiguana is offline
Member
 
Join Date: Mar 2011
Posts: 22
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
Reply With Quote
  #2  
Old 01-10-2012, 02:17 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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)
Reply With Quote
  #3  
Old 01-11-2012, 08:01 AM
hotshotiguana hotshotiguana is offline
Member
 
Join Date: Mar 2011
Posts: 22
Thanks. That works as advertised.
Reply With Quote
Reply

Tags
addslider, numpy

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
positions on animation path whj Vizard 3 10-27-2009 01:21 PM


All times are GMT -7. The time now is 02:05 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC