Re: Tkinter Text widget get()
Question posted by: John McMoangle
(Guest)
on
July 5th, 2008 09:05 AM
Hey guys. I am having trouble understanding the get() method from
Quote:
the Tkinter Text() widget. It isn't like the entry.get() one I am
used to. I know you have to put tags in, or at least I read. I
tried this but it didn't work. I think I was putting the tags in
wrong but I am not sure. I just need an example. So if someone
could maybe modify this code to get EVERYTHING inside the text widget.
>
text = Text(parent)
text.pack()
>
text.insert(END, "I am text!")
>
Of course, I will have much more text, but I still want to get
everything in the box.
>
|
The arguments to the get method of the Text widget are strings in the form of
"line.position".
So, text.get('1.5', '2.7') returns the text from line 1 position 5 to line 2
position 7.
There are also some special tagged names such as END and SEL.
So, if you want to get all the text in your Text widget, text.get('1.0', END)
will do the trick.
I recommend finding the appropriate documentation at
http://www.pythonware.com/library/t...r-reference.htm
Regards,
John
Not the answer you were looking for? Post your question . . .
189,873 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).
|
|
|
Latest Articles: Read & Comment
Top Community Contributors
|