It happened with checkbuttons in different clases. It can be seen by running this code and clicking in any checkbutton:
from tkinter import *
import constant
class Frame1(Frame):
def __init__(self, parent):
Frame.__init__(self, parent, bg="lightgray")
self.parent = parent
self.texto=[None]*10
self.cboton=[None]*10
self.widgets()
def widgets(self):
for row1 in range(10):
t="V%s"%row1
self.cboton[row1]=Checkbutton(self, padx=7, relief=RIDGE, text=t,
onvalue=1, offvalue=0, font='Courier 10')
self.cboton[row1].grid(row=row1, column=0)
self.texto[row1] = Text(self,width=5, height=1)
self.texto[row1].insert(INSERT, "00.00")
self.texto[row1].grid(row=row1, column=1)
class MainW(Tk):
def __init__(self, parent):
Tk.__init__(self, parent)
self.parent = parent
self.mainWidgets()
def mainWidgets(self):
self.window=[None]*18
for col in range(18):
texto="Bloq-#%i"%col
self.label = Label(self, text=texto)
self.label.grid(row=0, column=col)
self.window[col] = Frame1(self)
self.window[col].grid(row=1, column=col)
if __name__=="__main__":
app = MainW(None)
app.mainloop()
I expected that a var of a class is hidden for other classes.