Apr-04-2020, 10:04 PM
You would have something like ths:
Whenever you have a collection of items that can grow arbitrarily think about using a list or a dictionary to hold your collection.
values= [] def addentry() value= StringVar() Entry(root, textvariable=value).grid(row=len(entries), column=1) values.append(value)If you want you can keep a handle for each Entry, but once they are created the variable is all you really need. To clear all the entries set all the variables to ''. To sum all the entries loop through the variables, convert the string to a number and add.
Whenever you have a collection of items that can grow arbitrarily think about using a list or a dictionary to hold your collection.