So in the following code I establish a Notebook in tkinter. I pull strings from the list VARS["IMPS"] and create pages with them in a dictionary using the strings as keys and the Frames as values.
My issue comes in when I establish the buttons, the function the button activates just prints the impname. However, when the application is built the while the labels always have the correct content in them and "impname". The buttons across all of the pages of the notebook always print the last string in the list VARS["IMPS"]. Why is this happening?
Necromicon = ttk.Notebook(self)
self.pages = {}
for impname in __VARS__["IMPS"]:
page = {}
# Formate is Imp_acrobat.Imp()
# impname is a string
self.pages[impname] = page
self.pages[impname]["Page"] = ttk.Frame(Necromicon)
Necromicon.add(self.pages[impname]["Page"], text=impname[4:])
x = ttk.Label(self.pages[impname]['Page'], text=impname)
x.config(wraplength=175, font=SMALL_FONT)
x.config(background='black', foreground='red')
self.pages[impname]['Scroll'] = x
self.pages[impname][impname + 'Button'] = tk.Button(
self.pages[impname]['Page'],
text='Activate',
command=lambda: self.modload(self, controller, impname))
self.pages[impname]['Scroll'].pack(fill="both", expand=True)
self.pages[impname][impname + 'Button'].pack()