[Tutor] Lots of variables

Øyvind python at kapitalisten.no
Sat Aug 6 19:19:19 CEST 2005


I am trying to write a gui that has a lot of checkboxes. It is over 200
different ones. I use a for statement to generate:

        ver = 200
        for i in ['Car','House','Boat','Plane']:
            self.fra26_che01p = Checkbutton (self.fra26)
            self.getattr(self,i)1 = IntVar()
            self.fra26_che01v = Checkbutton (self.fra26)
            self.getattr(self,i)2 = IntVar()
            ver = ver + 17

The variable does not work for obvious reasons. I need to change variable
for each new creation. If I had made the variables manually, I would have
written (variable=self.car1)/(variable=self.car2) and so forth. Is there
some way I can make lots of variables without declaring them up front?

Thanks in advance....

This email has been scanned for viruses & spam by Decna as - www.decna.no
Denne e-posten er sjekket for virus & spam av Decna as - www.decna.no

More information about the Tutor mailing list