ControlP5 in py5

This is so cool, @svan! I love this, thank you for sharing it.

With the py5_tools.processing.download_library() feature it becomes even easier to use it, you don’t have to manually copy the jar file!

Check out my attempt at simplifying a bit the sketch:

peek_1

# Uses Imported mode for py5, learn more at <py5coding.org>

# To install the ControlPy5 .jar, you only need the following two lines once
from py5_tools.processing import download_library
print(download_library('ControlP5'))  # printed to see details of how it went

from controlP5 import ControlP5  # on module mode, this must come after import py5

def setup():
    global slider, cw
    size(450, 450)

    window_title("DotView Demo") 
    this = get_current_sketch()
    cp5 = ControlP5(this)
    slider = cp5.addSlider("slider", 0, 255, 50, 30, 10, 200, 20)
    cw = cp5.addColorWheel("c", 300,10,100)
    cw.setRGB(color(128,0,255))
 
def draw():
    background(209)
    fill(cw.getRGB())
    circle(200, 220, slider.getValue())
1 Like