Python - IntVar/entry in tkinter will only return 0
<p>I am trying to write a program to do calculations and solve equations, using a gui made with tkinter, and have gotten to the point of putting in known values. The values are entered in tkinter's entry widget(I am using IntVar(), not StringVar(), so that's not the problem), but for some reason, no matter the value I enter, it will only return as 0. code below:</p>

<pre><code>def getvalues_1dk():
    getvalues2frame = ttk.Frame(calculations_root, width=100, height=100, padding="5")
    getvalues2frame['borderwidth'] = 3
    getvalues2frame['relief'] = 'raised'
    getvalues2label = ttk.Label(getvalues2frame, text="Step 5: Enter a value for each of the variables you\n"
                                                      " selected in step 4.")
    getvalues2label.grid(row=1, column=1, sticky=(N, W))
    getvalues2frame.grid(row=0, column=0, sticky=E)
    getvalue1(getvalues2frame)
    return getvalues2frame

def getvalue1(getvalues2frame):
    if known1d1.get() and known1d2.get() and known1d3.get():
        known1d1entryvar = IntVar()
        known1d1entry = ttk.Entry(getvalues2frame, textvariable=known1d1entryvar)
        ttk.Label(getvalues2frame, text=known1d1.get()).grid(row=2, column=1, sticky=W)
        known1d1entry.grid(row=2, column=1, sticky=E)
        ttk.Button(getvalues2frame, text="Confirm",
                   command=(getvalue2(getvalues2frame, known1d1entryvar))).grid(row=3, column=1,
                                                                                sticky=E)
        return known1d1entryvar

def getvalue2(getvalues2frame, known1d1entryvar):
    if known1d1entryvar.get():
        known1d2entryvar = IntVar()
        known1d2entry = ttk.Entry(getvalues2frame, textvariable=known1d2entryvar)
        ttk.Label(getvalues2frame, text=known1d2.get()).grid(row=4, column=1, sticky=W)
        known1d2entry.grid(row=4, column=1, sticky=E)
        ttk.Button(getvalues2frame, text="Confirm",
                   command=(getvalue3(getvalues2frame, known1d1entryvar, known1d2entryvar))).grid(row=5, column=1,
                                                                                                  sticky=E)
        return known1d2entryvar

def getvalue3(getvalues2frame, known1d1entryvar, known1d2entryvar):
    if known1d2entryvar.get():
        known1d3entryvar = IntVar()
        known1d3entry = ttk.Entry(getvalues2frame, textvariable=known1d3entryvar)
        ttk.Label(getvalues2frame, text=known1d3.get()).grid(row=6, column=1, sticky=W)
        known1d3entry.grid(row=6, column=1, sticky=E)
        calculatebutton = ttk.Button(getvalues2frame, text="Show formula and calculate",
                                     command=(
                                         calculate1d(known1d1entryvar, known1d2entryvar, known1d3entryvar,
                                                     solveforvar1d, unusedvar1d)))
        calculatebutton.grid(row=7, column=1, sticky=E)

def calculate1d(known1d1entryvar, known1d2entryvar, known1d3entryvar, solveforvar1d, unusedvar1d):
    if known1d1entryvar.get() and known1d2entryvar.get() and known1d3entryvar.get():
        knownvar1 = known1d1entryvar.get()
        knownvar2 = known1d2entryvar.get()
        knownvar3 = known1d3entryvar.get()
        print(knownvar1, knownvar2, knownvar3)
        solveforvar1d = Symbol(solveforvar1d)
        print(solveforvar1d)
        print(unusedvar1d)
</code></pre>

<p>This section of code is supposed to 1) create a labeled frame where values will be entered, 2) create an entry box for an integer value of the first known variable and a button to confirm the value and create the next entry box, 3) create the next entry box when the button is pressed, 4) create another button to confirm the 2nd value and create the next entry box, 5) create a third entry box when button is pressed, and create another button to run the function calculate1d(), which is currently a placeholder to see if the program returns the correct values.</p>

<p>However, it doesn't work. The code as it is now stops after creating the entry box for the first value and creating the button to confirm and create the 2nd entry box and button. With this code, there is no point where I actually see what value is returned for the entry boxes. However I tried putting putting putting <code>print(known1d1entryvar.get())</code> at the start of <code>getvalue2()</code> to see what value it was returning, and no matter what value I entered, it returned 0. Furthermore, it printed the value, 0, when I pressed the button(not shown) that calls the <code>getvalues_1dk()</code> function, not when I wanted it to, after entering a number in the first entry box and pressing the first button. </p>

<p>Please help me out here. I've been stuck on this for about two days now and I've tried everything I can think of. </p>

<p>EDIT: If necessary, I can post my entire source code on a paste website. Just ask if necessary.</p>