From: Bruce S. <bas...@un...> - 2004-01-18 16:50:56
|
Here's a specific example that does what you want: from visual.controls import * def update(): k = float(int(100*(slider1.value)))/100 title.text = '%s' % k k = 0 title = label(text='0') c = controls() slider1 = slider(x=0, y=0, width=10, length=50, max=6, action=lambda: update()) while 1: c.interact() Perhaps you could suggest how the documentation on these controls could be improved? Thanks. Bruce Sherwood Cornelius Sicker wrote: > Hi, > thanks for your answer. I already tried to create a slider with > visual.controls, i neglect to write this. I'm sorry. > I also tried to install the current version of VPython, but this > requires Python 2.3, and the module "controls" is already implemented in > my version of VPython. For better representation > I give you my code (so far I've written): > > slider1 = slider(x=0, y=0, width=2, length=20, action='here I don't know > what to do') > > What should I do, if I want to change the value of for example the > variable "k" from 0 to 6 > in steps of 0.01 with this slider? > > Thanks for the answers to my other questions, too. > > -Cornelius Sicker > |