Tkinter

Entry Tkinter | Python 3

In this tutorial, we are going to see how to use Entry widget in Tkinter. The Entry widget is used to enter text. This widget allows the user to enter one line of text.

To enter multiple lines of text, use the Text widget.

If you want to display one or more lines of text that cannot be edited by the user, you must use the Label widget.
 


 
 

Syntax:

Here is the syntax to create this widget:

e = Entry ( master, option = value, ... )

 

Parameters:
  • master : This represents the parent window.
  • options : Options can be used as comma separated key-value pairs. See the following example:

 

 

Example:
from tkinter import *

gui = Tk()

l = Label( gui, text = "Enter your age" )
l.pack( side = LEFT )

e = Entry( gui, bd = 5 )
e.pack( side = RIGHT )

gui.mainloop()

Output:


 
mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

Your email address will not be published. Required fields are marked *