[Tutor] Lots of variables
Øyvind
python at kapitalisten.no
Sat Aug 6 19:19:19 CEST 2005
Hello.
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.fra26_che01p.place(in_=self.fra26,x=5,y=ver)
self.fra26_che01p.configure(text=i)
self.getattr(self,i)1 = IntVar()
self.fra26_che01p.configure(variable=getattr(self,i))
self.fra26_che01v = Checkbutton (self.fra26)
self.fra26_che01v.place(in_=self.fra26,x=70,y=ver)
#self.fra26_che01v.configure(text="1p")
self.getattr(self,i)2 = IntVar()
self.fra26_che01v.configure(variable=getattr(self,i))
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