title: Using an array, I get this error: TypeError: an integer is required
body: <p>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.  </p>
  
  <p>Now that I have established the array, I get this new error:</p>
  
  <p>EDIT:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <pre><code>#List Generator
  
  archstartred = []
  archstartgrn = []
  archstartblu = []
  
  ##Red List
  for x in range (0, cursorsize):
      if len(archstartred) &lt; cursorsize:archstartred.insert(0,cursred)
  
  for x in range (0, (archnodes-cursorsize)):
      if len(archstartred) &lt; archnodes:archstartred.append(backred)
  
  ##Green List
  for x in range (0, cursorsize):
      if len(archstartgrn) &lt; cursorsize:archstartgrn.insert(0,cursgrn)
  
  for x in range (0, (archnodes-cursorsize)):
      if len(archstartgrn) &lt; archnodes:archstartgrn.append(backgrn)
  
  ##Blue List
  for x in range (0, cursorsize):
      if len(archstartblu) &lt; cursorsize:archstartblu.insert(0,cursblu)
  
  for x in range (0, (archnodes-cursorsize)):
      if len(archstartblu) &lt; 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&lt;=(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]))
  </code></pre>
  
  <p>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.</p>
  
  <p>Of course, once I figure out this effect, I'll be able to make more complex effects based on mathematical formulas.</p>