'How to create a variable whose name is a function call?
I'm writing a program using tkinter where an instance of the class Myclass is created every time the button create is pressed. I have a problem where I want the name of each instance to be whatever is in an entry at any given moment. For example
import tkinter
def create():
entry.get() = Myclass(objects)
class Myclass:
def __init__(self, objects)
entry = tkinter.Entry()
create_button = tkinter.Button(text="Create", command=create)
My issue is that I obviously can't assign a function call to another function call, so entry.get() = Myclass(objects) creates an exception. Is there a way for me to create a variable whose name is entry.get() ?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
