title: What causes Attribute Error: 'classObject' object has no attribute '_w'?
body: <p>I'm working with Python 3.1, and I want to create a game. I made a <code>class Board(Canvas):</code> Why? because I need to keep track of the pieces via 'tag'. BUT, when I attempt to bind a tag to a piece, I get a traceback that read something like...</p>
  
  <pre><code>Traceback (most recent call last):
  File "/Users/bluedragon1223/Desktop/Djambi0-2.py", line 282, in &lt;module&gt;
  x = Board()
  File "/Users/bluedragon1223/Desktop/Djambi0-2.py", line 94, in __init__
  self.tag_bind(self.canM, '&lt;1&gt;', _onPieceClick)
  File "/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/tkinter/__init__.py",
  line 2103, in tag_bind
  return self._bind((self._w, 'bind', tagOrId),
  AttributeError: 'Board' object has no attribute '_w'
  </code></pre>
  
  <p>I can follow the code all the way to the error, and I think I lack the understanding of what '_w' is here.</p>
  
  <p>After <code>x = Board()</code> the <code>def __init__(self, window=mainWin):</code> contains <code>self.M = PhotoImage(file=path+'M.gif')</code>. <code>self.M</code> then goes into:</p>
  
  <pre><code>    def __draw(self):
      canvas = Canvas(mainWin,width=810,height=810)
      for i in range(9):
          canvas.create_line(90*i,0,90*i,810)
      for j in range(9):
          canvas.create_line(0,90*j,810,90*j)
      canvas.create_rectangle(3,810,810,3)
      canvas.bind('&lt;1&gt;', _point2square)
      canvas.pack()
      self.canM = canvas.create_image(405,405,image=self.M,tag = 'M')
  </code></pre>
  
  <p>After that, it's used in <code>self.tag_bind(self.canM, '&lt;1&gt;', _onPieceClick)</code>. And that's where the error occurs. My question is why? What did I do, and how do I fix it?</p>
  
  <p>I appreciate any sort of help!</p>