Closed ReikoR closed 2 years ago
functools.partial can be used to bind values to trackbar onChange
function.
Something like this should work:
from functools import partial
def update_value(value_name, new_value):
data[value_name] = new_value
for key in data.keys():
cv2.createTrackbar(key, "Processed", data[key], 255, partial(update_value, key))
throwerspeed
can be class variable.
move_style
should not be global. It can be class variable.
Globals are removed.
https://github.com/ut-robotics/picr21-team-sauna-madis/blob/4c6d1c92842338af8816641a25f335507717bdcf/saun/uusmain.py#L32
Either pass variables as function arguments and return changed variables as function return values or create a class.