tkinter.scrolledtextScrolled Text Widget滚动文本小部件

Source code: Lib/tkinter/scrolledtext.py


The tkinter.scrolledtext module provides a class of the same name which implements a basic text widget which has a vertical scroll bar configured to do the “right thing.” tkinter.scrolledtext模块提供了一个同名类,该类实现了一个基本文本小部件,该小部件具有一个配置为执行“正确操作”的垂直滚动条。Using the ScrolledText class is a lot easier than setting up a text widget and scroll bar directly.使用ScrolledText类比直接设置文本小部件和滚动条容易得多。

The text widget and scrollbar are packed together in a Frame, and the methods of the Grid and Pack geometry managers are acquired from the Frame object. 文本小部件和滚动条打包在一个Frame中,GridPack几何管理器的方法从Frame对象中获取。This allows the ScrolledText widget to be used directly to achieve most normal geometry management behavior.这允许ScrolledText小部件直接用于实现大多数正常的几何图形管理行为。

Should more specific control be necessary, the following attributes are available:如果需要更具体的控制,可使用以下属性:

classtkinter.scrolledtext.ScrolledText(master=None, **kw)
frame

The frame which surrounds the text and scroll bar widgets.围绕文本和滚动条小部件的框架。

vbar

The scroll bar widget.滚动条小部件。