So after some trial and error, I think I have my math finally figured out correctly. Initially, I started this as a set of complex lists, but then found out that the array function is more suited to what I need.
Now that I have established the array, I get this new error:
EDIT:
Traceback (most recent call last):
File "(stdin)", line 1, in (module)
File "backandforth3.py", line 118, in (module)
frames.insert((x+f), (archstartred[x]))
TypeError: list index out of range
As I frustratingly yell at the computer that all the data already is an integer, I spare my computer monitor and thought I'd try here. All the help on here so far has been fantastic.
Here's how I generate the array and the data for the array: EDIT: Added the list generator to the program code as it seems to be generating non-integer values.
#List Generator
archstartred = []
archstartgrn = []
archstartblu = []
##Red List
for x in range (0, cursorsize):
if len(archstartred) < cursorsize:archstartred.insert(0,cursred)
for x in range (0, (archnodes-cursorsize)):
if len(archstartred) < archnodes:archstartred.append(backred)
##Green List
for x in range (0, cursorsize):
if len(archstartgrn) < cursorsize:archstartgrn.insert(0,cursgrn)
for x in range (0, (archnodes-cursorsize)):
if len(archstartgrn) < archnodes:archstartgrn.append(backgrn)
##Blue List
for x in range (0, cursorsize):
if len(archstartblu) < cursorsize:archstartblu.insert(0,cursblu)
for x in range (0, (archnodes-cursorsize)):
if len(archstartblu) < archnodes:archstartblu.append(backblu)
archstartred = [int(value) for value in archstartred]
archstartgrn = [int(value) for value in archstartgrn]
archstartblu = [int(value) for value in archstartblu]
#Frame Creation
from array import *
frames=array('i', (0 for i in range (0,workingframes*archnodes*3)))
#Frame Population
for f in range (0, workingframes):
if f<=(workingframes/2):
for x in range (0, (archnodes*3)):
frames.pop(x+f)
frames.insert((x+f), (archstartred[x]))
frames.pop((x+f)+workingframes)
frames.insert((x+f+workingframes), (archstartgrn[x]))
frames.pop((x+f)+workingframes*2)
frames.insert((x+f+workingframes*2), (archstartblu[x]))
for y in range (0, nodesperframe):
archstartred.pop()
archstartgrn.pop()
archstartblu.pop()
archstartred.insert(0, backred)
archstartgrn.insert(0, backgrn)
archstartblu.insert(0, backblu)
else:
for y in range (0, nodesperframe):
archstartred.pop(0)
archstartgrn.pop(0)
archstartblu.pop(0)
archstartred.append(backred)
archstartgrn.append(backgrn)
archstartblu.append(backblu)
for x in range (0, (archnodes*3)):
frames.pop(x+f)
frames.insert((x+f), (archstartred[x]))
frames.pop((x+f)+workingframes)
frames.insert((x+f+workingframes), (archstartgrn[x]))
frames.pop((x+f)+workingframes*2)
frames.insert((x+f+workingframes*2), (archstartblu[x]))
This is the same program I've been dealing with in my other posts. Basically, it's to generate data for use in an RGB lighting system. This "simple" program will generate a back and forth effect using 2 colors. The other variables include length of time the effect takes, frame size (we use "Sequencers" to generate displays and you can vary the frame size in the sequencer), "cursor" size, etc.
Of course, once I figure out this effect, I'll be able to make more complex effects based on mathematical formulas.
frames.insert((x+f), (archstartred[x])). Obviouslyxandfare integers, because they're defined here as such via theforloop, and you never redefine them inside the loop. Soarchstartred[x]must not be an integer. Show us the definition ofarchstartred[x].archstartredarray?