I'm attempting to make a dynamic GUI where clicking a button causes the creation of a new frame that is placed above the button with 3 entry widgets (user options) inside of it, and I need to be able to read the user input from the 3 entry widgets & possibly alter them. Each time the button is pressed, three new callable entry widgets should appear.
I know that this is wrong because it has been giving me errors, but could something similar to the lists be used to create the widgets dynamically?
from Tkinter import *
app = Tk()
frameNames = []
widgetNames = []
def createwidgets():
global widgetNames
global frameNames
frameNames += (str("g"+str(len(frameNames)))) #why does the letter & number get added as seperate elements?
widgetNames += [(str("w"+str(len(widgetNames)-1))),
(str("w"+str(len(widgetNames)))),
(str("w"+str(len(widgetNames)+1)))]
frameNames[len(frameNames) - 1] = Frame(app)
frameNames[len(frameNames) - 1].pack()
widgetNames[len(widgetNames) - 3] = Entry(frameNames[len(frameNames) - 1])
widgetNames[len(widgetNames) - 3].pack()
widgetNames[len(widgetNames) - 2] = Entry(frameNames[len(frameNames - )- 1])
widgetNames[len(widgetNames) - 2].pack()
widgetNames[len(widgetNames) - 1] = Entry(frameNames[len(frameNames) - 1])
widgetNames[len(widgetNames) - 1].pack()
createWidgetButton = Button(app, text="createWidgets", command=createwidgets())
createWidgetButton.grid(sticky=S)
app.mainloop()