A
A
asderbanger2018-06-13 17:27:38
Python
asderbanger, 2018-06-13 17:27:38

How to add/remove class instances in Tkinter?

This is a noob question, but I can't seem to find an answer.
There is an application, a counter, which counts some parameters for several objects
A class (Counter) is written.
Next, before root.mainloop(), from the height of my skill, I write the following:
a = Counter(parameters)
b = Counter(parameters)
And so on. But the number of items often changes, and it is inconvenient to rewrite the lines each time adding new instances. How can you make it so that by clicking on a button in a running program you can remove a class or add a new one at the end?
Tools for changing the parameters of a class instance in the table are already provided, so there is no problem with this. I myself thought that I could create a dictionary of instances and add instances there or remove them, but for some reason I don’t like this idea.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question