[Tutor] Tkinter

Alan Gauld alan.gauld at btinternet.com
Tue Aug 25 02:22:37 CEST 2015

On 24/08/15 21:31, The Dildoge Gamer wrote:

> unlimited number of text boxes to use. The problem is; they all have the
> same name, so the text you type in one of them is copied to all of the
> others. My question: How do i make a value go up by one when a button is
> clicked, and how do i treat somethings name(The something being the new
> attribute you add) as a property, so that when a new one is made, its name
> is "Att" and then whatever the value equals. Kinda like if you say -

You really shouldn't do that. It gets awfully complicated very quickly.

Instead, use a list to store these text box references. You can then 
access them using an index into the list.

Something like

textBoxes = []
newTB = TextBox(...)
textBoxes[3].insert(END,'Fourth text box')

Alternatively you could use a dictionary and give each text
box a string or numeric key. But in this case I suspect a
list is a better fit for your situation.

Alan G
Author of the Learn to Program web site
Follow my photo-blog on Flickr at:

More information about the Tutor mailing list