I’m trying to make a very simple demo where the RGB values of a polygon object can be changed up and down by a set value when a button is pressed (one for up, one for down). At the moment, I’m just trying to go through grays, starting with a value, e.g. [5,5,5] and going through [10,10,10], [15,15,15], etc. with each press of a button.
I’ve made a single trial in builder with a single polygon and have a code object with the following in ‘each frame’:
keys = event.getKeys(keyList=['left','right']) print(polygon.fillColor) if len(keys) > 0: print(keys) if (keys[len(keys)-1] == 'left'): polygon.fillColor += [-20,-20,-20] event.clearEvents() if (keys[len(keys)-1] == 'right'): polygon.fillColor += [20,20,20] event.clearEvents()
According to print(polygon.fillColor), the RGB values are changing, but this is not reflected in the appearance of the shape on screen, so it doesn’t seem to be drawing correctly.
Can anyone suggest what I might be doing wrong?