python - Storing frames in list -
i'm trying store frames in list can widgets 3 3 on top of each other whit small space in between them
but can't seem make work.
code:
self.cbocombo = [] self.frame_type = [] x in range(7): self.cbocombo.append([]) y in range(3): self.cbocombo[x].append([]) in range(7): self.frame_type.append(i) self.frame_type[i] = frame(self.frame_type) self.frame_type[i].pack(side=top, expand=1, ipady= 11) self.cbocombo[i][0] = ttk.combobox(self.frame_type[i], values=self.valcombo, textvariable=self.varcombo[1][0]) self.cbocombo[i][0].pack(padx= 5) self.cbocombo[i][1] = ttk.combobox(self.frame_type[i], values=self.valcombo, textvariable=self.varcombo[1][1]) self.cbocombo[i][1].pack(padx= 5) self.cbocombo[i][2] = ttk.combobox(self.frame_type[i], values=self.valcombo, textvariable=self.varcombo[1][2]) self.cbocombo[i][2].pack(padx= 5)
error message:
file "file.py", line 89, in __init__ self.frame_type[i] = frame(self.frame_type) file "c:\python27\lib\lib-tk\tkinter.py", line 2453, in __init__ widget.__init__(self, master, 'frame', cnf, {}, extra) file "c:\python27\lib\lib-tk\tkinter.py", line 1965, in __init__ basewidget._setup(self, master, cnf) file "c:\python27\lib\lib-tk\tkinter.py", line 1943, in _setup self.tk = master.tk attributeerror: 'list' object has no attribute 'tk'
is there solution or way done?
thanks
following tkinter docs:
w = frame ( master, option, ... ) parameters: master: represents parent window.
your self.frame_type
doesn't object represents parent window.
Comments
Post a Comment