title: Python: Object does not support indexing
body: <p>Yes, this question has been asked before. No, none of the answers I read could fix the problem I have.</p>
  
  <p>I'm trying to create a little Bounce game. I've created the bricks like this:</p>
  
  <pre><code>def __init__(self,canvas):
      self.canvas = canvas
      self.brick1 = canvas.create_rectangle(0,0,50,20,fill=random_fill_colour(),outline=random_fill_colour())
      self.brick2 = canvas.create_rectangle(50,0,100,20,fill=random_fill_colour(),outline=random_fill_colour())
      self.brick3 = canvas.create_rectangle(100,0,150,20,fill=random_fill_colour(),outline=random_fill_colour())
      self.brick4 = canvas.create_rectangle(150,0,200,20,fill=random_fill_colour(),outline=random_fill_colour())
      self.brick5 = canvas.create_rectangle(200,0,250,20,fill=random_fill_colour(),outline=random_fill_colour())
      self.brick6 = canvas.create_rectangle(250,0,300,20,fill=random_fill_colour(),outline=random_fill_colour())
      self.brick7 = canvas.create_rectangle(300,0,350,20,fill=random_fill_colour(),outline=random_fill_colour())
      self.brick8 = canvas.create_rectangle(350,0,400,20,fill=random_fill_colour(),outline=random_fill_colour())
      self.brick9 = canvas.create_rectangle(400,0,450,20,fill=random_fill_colour(),outline=random_fill_colour())
      self.brick10 = canvas.create_rectangle(450,0,500,20,fill=random_fill_colour(),outline=random_fill_colour())
      self.bricksId = [self.brick1,self.brick2,self.brick3,self.brick4,self.brick5,self.brick6,self.brick7,self.brick8,self.brick9,self.brick10]
  </code></pre>
  
  <p>And I'm trying to reference the ID of <code>bricksId[0]</code> over here:</p>
  
  <pre><code>self.hit_brick(pos,self.bricks.bricksId[0])
  </code></pre>
  
  <p>Earlier, in the <code>__init__</code>, I define bricks as bricks, which is defined as <code>Brick(canvas)</code>. However, the error states:</p>
  
  <pre><code>TypeError: 'Brick' object does not support indexing
  </code></pre>
  
  <p>In the answers to the other questions of this subject, I cannot find any that help me access <code>bricks.bricksId[0]</code>.</p>