[Tutor] Recursive Tkinter buttons

Adam Cripps kabads at gmail.com
Sat Feb 26 20:48:25 CET 2005


On Fri, 25 Feb 2005 12:21:18 +0100, Michael Lange 
<snip>
> 
> You see, in my example above I called the list "buttonlist" instead of "button"; maybe this naming
> helps avoid confusion .
> 
> Best regards
> 
> Michael

Many thanks for the help here. 

I got all my buttons displayed and stored in the list with: 

for i in range (1, 11):
			submittext = ">>> "
			self.s = Button(text=submittext, command = self.showButton)
			self.s.grid(column=4, row=i+4)
			submitlist.append(self.s)


 - however, when I click the button, I want self.showButton to know
which one of them was pressed. I've seen in other gui programming the
idea of an id or identifier - I can't see that here. Ideally, I would
like to know the value of i in self.showButtons - but when I use
self.showButtons(i) showButtons gets called straight at run time.

Any ideas? 

TIA
Adam

-- 
http://www.monkeez.org
PGP key: 0x7111B833


More information about the Tutor mailing list