Dynamically Adding Tkinter Widgets
<p>For my computer science class we have been assigned the task of making a movie kiosk. Users add items to there cart which I store in the form of lists. When the check out screen is loaded I want to added labels displaying which items the user has in their cart. I have the following code:</p>

<pre><code>class CheckOut(tk.Frame): #check out page

def __init__(self, parent, controller):
    tk.Frame.__init__(self, parent)
    #create and place base widgets
    backGroundPicture = ImageTk.PhotoImage(Image.open("Background.jpg"))
    backGroundLabel = tk.Label(self, image=backGroundPicture, borderwidth=0)
    backGroundLabel.image = backGroundPicture
    backGroundLabel.place(x=0, y=0, anchor=tk.NW)

    checkOutLabel = tk.Label(self, text="Check Out", font=("Verdana", 48), bg="#001f33", fg="red")
    checkOutLabel.place(relx=0.5, rely=0, anchor=tk.N)

    returnButton = tk.Button(self, text="Return to Main Menu", bg="#4db8ff", fg="black",
                       command=lambda: controller.show_frame(StartPage))
    returnButton.place(relx=1, rely=1, anchor=tk.SE)

def update(): #add new widgets displaying items purchase
    print("debug")
    itemLists = []
    for each in movieTitles:
        i = movieTitles.index(each)
        if(adultTickets[i] != 0):
            tempLabel = tk.Label(self, text="Adult Ticket: " + str(adultTickets[i]) + " " + each)
            itemLists.append(tempLabel)
        if(childTickets[i] != 0):
            tempLabel = tk.Label(self, text="Child Ticket: " + str(childTickets[i]) + " " + each)
            itemLists.append(tempLabel)
    for i in itemLists:
        i.place(x=100, y=200, anchor=tk.CENTER)
    print(itemLists)
</code></pre>

<p>Everything is working except when I try to create the labels with the parent of self, It is undefined. I would like to place them in the same frame that the init method is using. How would I go about getting access to self? Is there some sort of work around I could use?</p>