import tkinter as tk w = tk.Tk() p_name = tk.StringVar(w) cpus = tk.StringVar(w) cyc = tk.StringVar(w) N_ts = tk.StringVar(w) T_cyc = tk.StringVar(w) def getvars(p_name, cpus, cyc, N_ts, T_cyc): p_name = p_name.get() cpus = cpus.get() cyc = cyc.get() N_ts = N_ts.get() T_cyc = T_cyc.get() print(T_cyc) field1 = tk.Label(w, text="project name").grid(row=0, column=0) entry1 = tk.Entry(w, textvariable = p_name).grid(row=0, column=1) field2 = tk.Label(w, text="CPUs").grid(row=1, column=0) entry2 = tk.Entry(w, textvariable = cpus).grid(row=1, column=1) field3 = tk.Label(w, text="number of cycles").grid(row=2, column=0) entry3 = tk.Entry(w, textvariable = cyc).grid(row=2, column=1) field4 = tk.Label(w, text="number of time steps").grid(row=3, column=0) entry4 = tk.Entry(w, textvariable = N_ts).grid(row=3, column=1) field5 = tk.Label(w, text="cycle periode").grid(row=4, column=0) entry5 = tk.Entry(w, textvariable = T_cyc).grid(row=4, column=1) button = tk.Button(w, text="Get vars", command=getvars(p_name, cpus, cyc, N_ts, T_cyc)).grid(row=5) w.mainloop()