Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a multiline entry with tkinter?

Entry widgets seem only to deal with single line text. I need a multiline entry field to type in email messages.

Anyone has any idea how to do that?

like image 566
xiaolong Avatar asked Mar 12 '12 04:03

xiaolong


2 Answers

You could use the Text widget:

from tkinter import *

root = Tk()
text = Text(root)
text.pack()
root.mainloop()

Or with scrolling bars using ScrolledText:

from tkinter import *
from tkinter.scrolledtext import ScrolledText

root = Tk()
ScrolledText(root).pack()
root.mainloop()
like image 117
timc Avatar answered Dec 21 '22 05:12

timc


Just use Text() widget.

For example:

import tkinter as tk

root = tk.Tk()
text = tk.Text(root)
text.pack()
root.mainloop()

Output:

Output

like image 36
AsmitTheCoder Avatar answered Dec 21 '22 04:12

AsmitTheCoder