Hi,
I'm having trouble trying to figure out how to create multiple objects that contain duplicate entries that can be uniquely identified within a Tkinter GUI.
I want a user to define an item and then define multiple characteristics about that item, save a dictionary of items, and then reload the items back into the GUI upon restart.
The code I'm have trouble with looks something like this.
def newitem(): itemframe = Frame(parent) entry1 = Entryfield(itemframe) entry2 = Entryfield(itemframe) button1 = Button(itemframe, command = update())
def update(): a = entry1.getvalue() b = entry2.getvalue() values = [a,b] print values
The problem I'm having is that as soon as the user runs newitem()
the previous itemframe loses its name and i can only access the most recently
created itemframe.
I feel like the most convenient way to accomplish this would be something like
x = Frame() in parent itemframe'x' = itemframe
Where 'x' is a unique integer. But I don't know how to create unique variables on the fly.
I'm sure there are a thousand ways to accomplish what I'm trying to,
and it seems like a trivial thing that gets dealt with all the time,
and I'm embarrased that I have to ask.
I'm pretty new to programming and this is my first attempt at a GUI or a really useful program. Thanks for your help.
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor