*click* Oh yeah. What you said. Oops. :\ Liam
On Fri, 25 Feb 2005 05:53:54 -0200, Ismael Garrido <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> > To: Liam Clarke <[EMAIL PROTECTED]> > References: <[EMAIL PROTECTED]> > <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> > <[EMAIL PROTECTED]> > > 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@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. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor