tkinter.scrolledtext
— Scrolled 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
中,Grid
和Pack
几何管理器的方法从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:如果需要更具体的控制,可使用以下属性: