from tkinter import Entry from tkinter import Tk from tkinter import Button from tkinter import END def get_entry_data(): data = entry_widget.get() entry_widget.delete(0, END) print(str(data)) root = Tk() root.title("Aimtocode") root.geometry('400x300') rows = 0 while rows < 10: root.rowconfigure(rows, weight=1) root.columnconfigure(rows,weight=1) rows += 1 entry_widget = Entry(root) entry_widget.grid(row=4, column=4) action_button = Button(root) action_button.configure(text='Get Data', command=get_entry_data) action_button.grid(row=5, column=4) root.mainloop()