Add a control in HTML. Handle it directly in Python.
Use an ordinary input, button, select, or slider. Find it from Python, attach an event listener, and update its state—without creating a backend endpoint or learning a custom widget toolkit.
slider = document.querySelector("#intensity-slider")
output = document.querySelector("#intensity-output")
def render(event=None):
output.textContent = f"{slider.value}%"
slider.addEventListener("input", render)Open the controls example