tkinter.scrolledtext --- スクロール付きテキストウィジェット

ソースコード: Lib/tkinter/scrolledtext.py


tkinter.scrolledtext モジュールは、基本的なテキストウィジェットと、それに連動するよう設定した縦スクロールバーを実装する、同名のクラスを提供します。 テキストウィジェットとスクロールバーを直接設定するより、ScrolledText クラスを使う方がはるかに簡単です。

テキストウィジェットとスクロールバーは、1 つの Frame にまとめて配置されます。 Pack、Grid、Place の各ジオメトリマネージャーのメソッドは、その Frame オブジェクトから取得します。 そのため、ScrolledText ウィジェットを直接使って、通常必要な配置管理のほとんどを行えます。

特定の制御が必要ならば、以下の属性が利用できます:

class tkinter.scrolledtext.ScrolledText(master=None, *, use_ttk=False, **kw)

The keyword arguments are passed to the Text widget.

When use_ttk is true, the surrounding frame and the scroll bar are the themed tkinter.ttk widgets; the default is the classic tkinter widgets.

バージョン 3.16 で変更: Added the use_ttk parameter.

frame

テキストとスクロールバーウィジェットを取り囲むフレーム。

vbar

スクロールバーウィジェット。