Skip to content

hackingmath/python-sliders

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

python-sliders

Sliders for the Python mode of Processing

If you use the Python mode for Processing, now you can add sliders to your sketch to change variable values dynamically. Simply put slider.py into the same folder as your sketch and import the Slider class at the top:

from slider import Slider

Outside the setup function, create the slider object by giving it a range (here it's 0 to 20) and a default value for when it first runs (in this case, 6):

slider1 = Slider(0,20,6)

Inside the setup function, give the slider a position:

slider1.position(20,20)

In the draw function, assign the value of the slider to a variable:

num = slider1.value()

You have the option of labeling the slider, too:

slider1.label = "number"

I've included a couple of example files to show how it works in action. Have fun and let me know how you like it!

About

Sliders for the Python mode of Processing

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages