Tkinter Button will not create due to error in function
Question: I am very new to Python and especially new to using Tkinter. I have a question
on getting a button of mine to actually create in the GUI.

I am trying to make a basic button that will take an input from an entry box
as an integer and add it to the current balance (kind of a little bank app).
The problem is that when I run the code and click the deposit button, the
second "Make Deposit" button that is supposed to spawn in (defined in the
make_deposit() function) will not spawn in due to an error in turning the
input for the entry box into an integer. As far as I can tell, this error is
only created because the second "Make Deposit" button is trying to run its
function before the button is pressed. Is there any way to prevent this from
happening? Below is the code, excluding some bits of the program not relevant
to the issue at hand.

    
    
    from Tkinter import *
    
    def get_entry(entry):
        global s 
        s = entry.get()
        s = int(s)
        data["current"] += s   
        label = Label(root, text = "Current Balance: %d" % (data["current"]))
        label.grid(row = 1, column = 0)
    
    
    def make_deposit():
        deposit = Entry(root, text = "Deposit Amount")
        deposit.grid(row = 2, column = 0)
        withdrawal.grid_forget()
        deposit_button = Button(root, text = "Make Deposit", command = get_entry(deposit))
        deposit_button.grid(row = 3, column = 0) 
    
    frame = Frame(root, height = 300, width = 300)
    frame.grid(row = 1, column = 0)
    
    label = Label(root, text = "ETA Until Car Purchase")
    label.grid(row = 0, column = 0)
    
    label = Label(root, text = "Current Balance: %d" % (data["current"]))
    label.grid(row = 1, column = 0)
    
    deposit = Button(root, text = "Make Deposit", command = make_deposit)
    deposit.grid(row = 2, column = 0)
    
    withdrawal = Button(root, text = "Make Withdrawal")
    withdrawal.grid(row = 3, column = 0)
    

Any help would be greatly appreciated, and please take into account that I am
an absolute beginner to Tkinter so the way that I have created some of the GUI
elements might not be the best way of doing so.


Answer: `command=` expect function name without `()` and arguments.

Using

    
    
    command = get_entry(deposit)
    

You run function `get_entry(deposit)` and its result is assigned to
`command=`.  
It is good if you want to assign function to `command=` dynamicly.

But you need `lambda`:

    
    
    command = lambda: get_entry(deposit)
    

