[Tkinter-discuss] Getting labels from a Text field

Cameron Laird Cameron at phaseit.net
Thu Aug 16 19:51:55 CEST 2007


On Sun, Dec 10, 2006 at 03:25:00PM -0700, Bob Greschke wrote:
			.
			.
			.
> Re: [Tkinter-discuss] Tkinter-discuss Digest, Vol 34, Issue 5I have a "form" in my program that has a Text() field with a little text, some Buttons with pictures, and some Labels inserted into it.  If I just do a Text().get(0.0, END) all I get is the text.  Is there a way to get, pardon my C, a pointer to the Labels so I can cget the text from them?
> 
> A picture of my form: www.greschke.com/unlinked/images/getem.jpg
> 
> I specifically want the 7-digit number in the light blue areas (the Labels).  I can keep a list of the numbers as I insert the Labels, but the user may edit some of them out of the list (like with the keyboard), so then my list wouldn't match.
			.
			.
			.
I like the JPEG; it's always a treat to see how Tkinter helps folks.

I apologize for letting this request languish so long.  While I shan't
make the time now to recode your application, I believe the answer you
sought is something like this:  you probably did a

    my_label = Tkinter.Label(text = "See me?")
    my_label_instance = window_create(index, window = my_label)

(see <URL: http://effbot.org/tkinterbook/text.htm >) to insert the Label.
The return value from window_create() will be a "Tkinter.Label instance";
you can just
   
    my_label_instance.cget("text")

at that point.


More information about the Tkinter-discuss mailing list