Tkinter: How to get Label wraplength functionality in Text Box

Mudcat mnations at gmail.com
Wed Oct 29 09:24:40 EDT 2008


Sounds like that would work really well. Problem is I can't get it to
work.

...
AttributeError: Text instance has no attribute 'count'
...

I think my usage is correct. I don't have any params at the moment,
but I was just checking the functionality.

numlines = widget.count()

According to the Tk 8.5 documentation it's used just like a normal
command.
WIDGET COMMAND
    pathName count ?options? index1 index2
        -chars
        -displaychars
        -displayindices
        -displaylines
        -indices
        -lines
        -xpixels
        -ypixels


As for the environment, I thought I had everything set up correctly.
I've got the latest stable version of Python 2.6 (r26:66721, Oct  2
2008, 11:35:03). I'm implementing the TTK wrappers to access Tk 8.5.
Although when I check the wrapper I don't see any mods to the Text
Box. I also don't see this option in the Tkinter.py file.

Is there something else I need to add to access this new feature?


On Oct 28, 6:51 pm, "Guilherme Polo" <ggp... at gmail.com> wrote:

>
> Are you looking for something like the new "count" command for the
> text widget in tk 8.5 ? "count" can count the number of logical lines
> (irrespective of wrapping), display lines (counts one for each time a
> line wraps) and some other things.
>
> >  Thanks
>
> > --
> >  http://mail.python.org/mailman/listinfo/python-list
>
> --
> -- Guilherme H. Polo Goncalves




More information about the Python-list mailing list