[Fwd: Re: [Tutor] Recursive Tkinter buttons]

Liam Clarke cyresse at gmail.com
Fri Feb 25 09:45:05 CET 2005


*click* Oh yeah. What you said. Oops. :\

Liam 

On Fri, 25 Feb 2005 05:53:54 -0200, Ismael Garrido
<ismaelgf at adinet.com.uy> wrote:
> Sent only to Liam... Forwading..
> 
> -------- Original Message --------
> Subject:        Re: [Tutor] Recursive Tkinter buttons
> Date:   Fri, 25 Feb 2005 05:45:00 -0200
> From:   Ismael Garrido <ismaelgf at adinet.com.uy>
> To:     Liam Clarke <cyresse at gmail.com>
> References:     <c7ff3855050224141925d5dc88 at mail.gmail.com>
> <421E8CD5.3080708 at tds.net> <c7ff3855050224225377dd598b at mail.gmail.com>
> <f2ff2d05022423194d795e69 at mail.gmail.com>
> 
> Liam Clarke wrote:
> 
> >>
> >>                for i in range(0,10):
> >>                        print i
> >>                        buttonlabel = "field " +str(i)
> >>                        button[i].append = Button (text=buttonlabel)
> >>                        button[i].grid(column=3, row = i+3)
> >>
> >>The current error is:
> >>
> >>  File "report.py", line 80, in createWidgets
> >>    button[i].append = Button (text=buttonlabel)
> >>IndexError: list index out of range
> >>
> >>
> >>
> > button = []
> >for i in range(0,10):
> >     print i
> >     print button[i]
> >
> >
> >Will cause the exact same error as button[i].append. Why? button=[],
> >it has no index.
> >Perhaps you just mean button[i] = Button (text=buttonlabel)?
> >
> >
> Nope, that will give an Array Out of Bounds exception. Remember buttons = []
> 
> What he meant is:
> 
> button.append( Button(text=buttonlabel) )
> 
> (I tested it, too!)
> 
> Bye
> Ismael
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
> 


-- 
'There is only one basic human right, and that is to do as you damn well please.
And with it comes the only basic human duty, to take the consequences.


More information about the Tutor mailing list