How to create a multiline entry with tkinter?

馋奶兔 提交于 2019-12-18 11:45:55

问题


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?


回答1:


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()


来源:https://stackoverflow.com/questions/9661854/how-to-create-a-multiline-entry-with-tkinter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!