"""
ControlP5::addListener() (v1.1)
GoToLoop (2018-Jun-20)
https://Discourse.Processing.org/t/
how-to-active-controlevent-in-controlp5-python-mode/1113/6
"""
add_library('controlP5')
bg = 0200
def setup():
size(400, 300)
global slider
slider = ControlP5(this).\
addSlider('slider').\
setSize(width>>1, 20).\
setPosition(width>>2, height>>1).\
setRange(0, 0xff).\
setValue(bg).\
addListener(sliderListener)
def draw(): background(bg)
def sliderListener(evt):
global bg
bg = int(evt.getValue())
1 Like