Problem Pythoncard tutorial

Steve M sjmaster at gmail.com
Mon Oct 17 18:11:10 EDT 2005


I'd say that the tutorial text (by Dan Shafer) and the file starter1.py
are not in sync.

The word 'self' doesn't appear in the source file, it isn't a keyword
(just a convention) or a literal, and it isn't imported by wildcard or
some other trickery. So just by inspection you can tell that the name
isn't defined at the point you are trying to use it, and so using the
name anywhere other than as the target of an assignment (is that called
an 'lvalue' ?) will cause a NameError.

I think the problem begins around where the tutorial says:
-----
Here's the important part to focus on:

   def on_menuFileExit_select(self, event):
        pass
-----

Based on the indentation and other clues, that was probably supposed to
be a method of the Minimal class, but it doesn't exist in the
starter1.py file. Just stick it in (as a method of that class) and
things should work.

FYI here is the version of starter1.py from my installed PythonCard
0.8.1:

#!/usr/bin/python

"""
__version__ = "$Revision: 1.6 $"
__date__ = "$Date: 2004/05/05 16:53:23 $"
"""

from PythonCard import model


class Minimal(model.Background):
    pass

if __name__ == '__main__':
    app = model.Application(Minimal)
    app.MainLoop()




More information about the Python-list mailing list