from pandac.PandaModules import * import direct.directbase.DirectStart from direct.gui.DirectGui import * def printValue(value): print value slider = DirectSlider(range=(0.0,1.0), value=1.0, pageSize=0.1, command = printValue) slider['extraArgs'] = [slider['value']] run()
Always 1.0, why?
I think it’s because…
>>> a = 5 >>> b = [a] >>> a 5 >>> b [5] >>> a = 8 >>> a 8 >>> b [5] >>>
In other words, you give it the value 1 at first, but it doesn’t make the slider[“extraArgs”] updated anytime you change the slider[“value”] afterwards.
try running the directSlider in a task or update it whenever the value is changed.