How to create a multiline entry with Tkinter?

TkinterPythonServer Side ProgrammingProgramming

Let us suppose that we want to create an Entry widget that supports multiline user input. In order to create a multiline Entry widget, we can use Text() constructor.

Example

Here, in this example, we will create a window that contains a multiline Entry widget.

#Import the library
from tkinter import *

#Create an object of tkinter window or frame
win = Tk()

#Define the geometry of window
win.geometry("650x250")

#Create an instance of Text Widget
text = Text(win)
text.pack()

win.mainloop()

Output

Running the above code will display a window with a text widget that supports multiline user Input.

raja
Published on 26-Mar-2021 10:57:29
Advertisements