I have a function which creates a dictionary depending on the file the user put in parameter.
And then I create a GUI which create as many CheckButtons as there are elements in dictionary.
Here is my code :
for element in self.listdiagram.dict_diagrams :
self.diagramVar = IntVar()
self.diagram = Checkbutton(self.window, text=element, variable=self.diagramVar, onvalue=1, offvalue=0)
self.diagram.pack(side = BOTTOM)
self.validate = Button(self.window, text="Validate", command=self.validateCallBack, width=15, height=3)
self.validate.pack(side = BOTTOM)
The problem is i can't access to the state of a specific checkbutton as they have all same variable name.
And I don't know how can I name them differently.
I tried to create variable name with dictionary element's name with setattr(self, element, 0) or with exec but it doesn't worked because str(element) can be very long.
How can i do this ?
Thanks for helping.