471,873 Members | 1,837 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,873 software developers and data experts.

Re: Tkinter Text widget get()

Hey guys. I am having trouble understanding the get() method from
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/tk...-reference.htm

Regards,

John

Jul 5 '08 #1
0 1465

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by bigbinc | last post: by
1 post views Thread by Pekka Niiranen | last post: by
2 posts views Thread by Tonino | last post: by
7 posts views Thread by Harlin Seritt | last post: by
8 posts views Thread by Dustan | last post: by
reply views Thread by Stewart Midwinter | last post: by
3 posts views Thread by J-Burns | last post: by
reply views Thread by zermasroor | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.