import tkinter as tk
def get_entry_text():
# Retrieve the text from the Entry widget and display it
entry_text = entry.get()
result_label.config(text=f"You entered: {entry_text}")
root = tk.Tk()
root.title("Text Entry Field and Retrieving Text")
# Create an Entry widget
entry = tk.Entry(root)
entry.pack()
# Create a button to retrieve the text
retrieve_button = tk.Button(root, text="Retrieve Text", command=get_entry_text)
retrieve_button.pack()
# Label to display the retrieved text
result_label = tk.Label(root, text="")
result_label.pack()
# Start the Tkinter main loop
root.mainloop()