[Tutor] Help with class in class

leam hall leamhall at gmail.com
Sun Sep 9 17:43:26 CEST 2012


Of course, showing the code might help...

 http://bpaste.net/show/44593/

Thanks!

Leam

On Sun, Sep 9, 2012 at 10:42 AM, leam hall <leamhall at gmail.com> wrote:

> I'm in the O'Reilly Python 2 class, so pointers to learning would be
> better than just answers, please. My brain is a bit slow but needs to go
> forward.
>
> Line 16 calls line 31. Rather, it is supposed to. I'm trying to figure out
> why I get
>
>   File "./ch8_project.py", line 31, in change_text_color
>     self.text.tag_configure('highlightline', foreground=fg_color)
> AttributeError: 'ch8_Project' object has no attribute 'text'
>
> If line 31 starts with "self." and
>
>   File "./ch8_project.py", line 31, in change_text_color
>     text.tag_configure('highlightline', foreground=fg_color)
> NameError: global name 'text' is not defined
>
>
> If Line 31 does not start with "self.". I understand the second problem
> but not the first.
>
> What am I missing?
>
> Thanks!
>
> Leam
>
>
> --
> Mind on a Mission <http://leamhall.blogspot.com/>
>
>


-- 
Mind on a Mission <http://leamhall.blogspot.com/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120909/3d8cac79/attachment-0001.html>


More information about the Tutor mailing list