More Tkinter Help please...
phlip_cpp at yahoo.com
Fri Jun 14 05:26:18 CEST 2002
> class PyShell:
> def __init__(self, top):
> self.b1 = Button(f, text="Execute", command=self.expyth)
> def expyth(self):
> output = os.popen("python -c").t1()
Those two 'def' markers /look like/ they are at the same level. But if your
editor expands tabs to 4 spaces, and if the first def had 4 spaces before
it, and the second def has 1 tab, Python's wonderful indent-based blocking
system will assume you like mixed indent modes, and then assume that a tab
is 8 spaces.
Then it will perceive the expyth as /inside/ the def __init__, where it's
not a member of PyShell. So the dot inside self.expyth will not be able to
find such a member.
Turn off tabs in your editor, perform a Tab to Space conversion (some few
editors support that), and then manually adjust the block indentions.
Style tip: Give everything longer, more pronouncable, and more intent
revealing names after you get this working.
-- Set phasers on illin' --
More information about the Python-list