简体   繁体   English

Tkinter 大号输入框

[英]Tkinter Large Entry Box

By default the entry box in Tkinter is only one row tall, is it possible to have a larger text box?默认情况下,Tkinter 中的输入框只有一行高,是否可以有更大的文本框?

Example例子

text_write = ttk.Entry(mainframe, width=50, textvariable=(text_to_write))

This will give you a text box that is 50 wide but only 1 row tall, is it possible to make the text box taller?这将为您提供一个 50 宽但只有 1 行高的文本框,是否可以使文本框更高?

The Entry widget is really just for one-line entries.Entry小部件实际上仅用于单行条目。 For larger text boxes, use the Text widget.对于较大的文本框,请使用Text小部件。 This gives you a large, multi-line, text-wrapping text box.这为您提供了一个大的多行文本环绕文本框。 For scrollable text boxes, it is easier to use the ScrolledText widget.对于可滚动文本框,使用ScrolledText小部件更容易。

from tkinter.scrolledtext import ScrolledText
self.textfield = ScrolledText.ScrolledText(self, wrap=Tkinter.WORD)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM