I am learning python. To practice, I am coding a hangman application in
pyGTK.
Here are my imports:

import pygtk
pygtk.require('2.0')
import gtk
import random

Here is my main class:

class PenduGTK:

Inside the class is a method with a bit of code:

    def masque(chaine,liInd=0):

        i = 0
        lenght = len(chaine)

The offending line is the one with len(chaine)

Here are the error messages:

 penduGTK.py
Traceback (most recent call last):
  File "/home/xxx/bin/penduGTK.py", line 23, in enter_callback
    self.lblMot.set_text(self.masque(self.motChoisi))
  File "/home/xxx/bin/penduGTK.py", line 44, in masque
    lenght = len(chaine)
AttributeError: PenduGTK instance has no attribute '__len__'

I would think it has to do with namespaces, scopes and visibility. But how
do I refer to built-in functions from inside a class?
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to