Change global variable to value in entry field
<p>How can I change a global variable to a value inputted by a user in an entry field?</p>

<pre><code>card_no = 0

def cardget():
    global card_no
    card_no = e1.get()
    print(card_no)


def menu():
    global card_no
    root = Tk()

    e1 = Entry(root).pack()
    Label(root, text= "Enter card number").pack(anchor= NW)
    Button(root, text= "Confirm card", command=cardget).pack(anchor= NW)

menu()
</code></pre>