variable name using a for

Alex alx5962NOSPAN at yahoo.com
Tue Mar 2 16:50:40 EST 2004


Sean you rock!!!!!!!!
You solved my problem !
1000 thank you are not enough ! :)

Alex

"Sean Ross" <sross at connectmail.carleton.ca> a écrit dans le message de
news:xv51c.8749$qA2.552179 at news20.bellglobal.com...
>
> "Alex" <alx5962NOSPAN at yahoo.com> wrote in message
> news:4044e177$0$24960$626a14ce at news.free.fr...
> [snip]
> > so in my code:
> > for x in range(nbSujets):
> >   self.button1 = xbmcgui.ControlButton(50, 100, 40, 30, "B"+str(x) )
> >   self.addControl(self.button1)
>
> for x in range(nbSujets):
>     button_name = "button%d"%x
>     setattr(self, button_name, xbmcgui.ControlButton(50, 100, 40, 30,
> "B%d"%x ))
>     self.addControl(getattr(self, button_name))
>
>
>
>





More information about the Python-list mailing list