First time posting. Really new to python.
I currently have an LED panel that's 16x96 with uv, green, and blue lights. The idea is to make this entire panel (a matrix) light up with a specific color selected by the user at a specific intensity entered by the user. I know there is a much more efficient way to write the code with variables but I need a little help. How can I light up the first column, fourth column, seventh column, and so on until the entire LED panel is lit up to UV? Or in case of green: the second column, fifth column, eigth, etc.? Basically +3 from the original each time. The code I have written below:
panel = np.zeros((16,96))
#function that encompasses object color when selected
def click1():
global a
global i
i = lightintensityentry.get()
a = var1.get() #variable associated with selection
if a == 1:
panel[:,0::3] = i
print(panel)
print("Object is a UV light!")
elif a == 2:
panel[:,1::4]= i
print(panel)
print("Object is a green light!")
elif a == 3:
panel[:,2::3]= i
print(panel)
print("Object is a blue light!")
elif a == 4:
print(panel) #would be all zeros, therefore no light
print("Object produces no light!")
I thought something similar to this would help: Edit every other item in an array It did not produce what I expected. Any help would be appreciated.
Looking for an explanation of what this does as well: panel[:,0::3] What does the 0::3 do exactly?
Thank you!