Yes, that first option worked. Special thanks... Steve ===============================
Footnote: If 666 is considered evil, then technically, 25.8069758 is the root of all evil. -----Original Message----- From: Python-list <python-list-bounces+gronicus=sga.ni...@python.org> On Behalf Of Peter Otten Sent: Sunday, August 30, 2020 5:29 AM To: python-list@python.org Subject: Re: Problem running a FOR loop Steve wrote: > Compiles, no syntax errors however, line 82 seems to run only once > when the FOR loop has completed. > Why is that? All fields are to contain the specifications, not just > the last one. It seems that passing the StringVar to the Entry widget is not sufficient to keep it alive. > for lineItem in range(len(ThisList)): > NewSpec = tk.StringVar() > SVRCodeEntered = ttk.Entry(window, width = 15, textvariable = > NewSpec) When the previous NewSpec is overwritten with the current one the previous gets garbage-collected and its value is lost. The straight-forward fix is to introduce a list: new_specs = [] > for lineItem in range(len(ThisList)): > NewSpec = tk.StringVar() new_specs.append(NewSpec) > SVRCodeEntered = ttk.Entry(window, width = 15, textvariable = > NewSpec) Another option is to store the StringVar as an attribute of the Entry: > for lineItem in range(len(ThisList)): > NewSpec = tk.StringVar() > SVRCodeEntered = ttk.Entry(window, width = 15, textvariable = > NewSpec) SVRCodeEntered.new_spec = NewSpec -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list