tkinter.scrolledtext --- 滚动文本控件¶
源代码: Lib/tkinter/scrolledtext.py
tkinter.scrolledtext 模块提供了一个同名类,实现了一个基本的文本控件并带有配置好的垂直滚动条。使用 ScrolledText 类比直接设置文本控件和滚动条要容易得多。
文本控件和滚动条被打包在一起放置在一个 Frame 中,并且 Pack 、 Grid 和 Place 几何管理器的方法均从该 Frame 对象获取。 这允许直接使用 ScrolledText 控件来实现大多数常规几何管理行为。
如果需要更具体的控制,可以使用以下属性:
- class tkinter.scrolledtext.ScrolledText(master=None, *, use_ttk=False, **kw)¶
The keyword arguments are passed to the
Textwidget.When use_ttk is true, the surrounding frame and the scroll bar are the themed
tkinter.ttkwidgets; the default is the classictkinterwidgets.在 3.16 版本发生变更: Added the use_ttk parameter.
- frame¶
围绕文本和滚动条控件的框架。
- vbar¶
滚动条控件。