Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to use the Entry widget in Tkinter?
The Entry widget is a single-line text widget defined in Tcl/Tk toolkit. We can use the Entry widget to accept and display single-line user input.
In order to use the Entry widget, you have to first create an Entry widget using the constructor Entry(parent, width, **options). Once we've defined our Entry widget, we can configure its properties such as font-properties, color, width, etc., using the configure() method.
Example
Let use create an Entry widget to accept the username and display it in the window.
# Import the required libraries
from tkinter import *
# Create an instance of tkinter frame or window
win = Tk()
# Set the size of the tkinter window
win.geometry("700x350")
def show_name():
# Create a Label widget
label = Label(win, text="Hello " + str(entry.get()) + "?", font=('Calibri 25')).pack(pady=20)
entry.delete(0, END)
# Create a Label
Label(win, text="Enter Your Name").pack()
# Create an Entry widget
entry = Entry(win, width=25)
entry.pack(pady=20)
Button(win, text="Submit", command=show_name).pack()
win.mainloop()
Output
When you run the above code, it will display a window with an Entry widget and a button. Type your name in the given Entry widget and click the button to show the message on the window.

Advertisements