ScrolledText
Bases: Frame
A text widget with optional vertical and horizontal scrollbars.
Setting autohide=True will cause the scrollbars to hide when the
mouse is not over the widget. The vertical scrollbar is on by
default, but can be turned off. The horizontal scrollbar can be
enabled by setting vbar=True.
This widget is identical in configuration to the Text widget other
than the scrolling frame. https://tcl.tk/man/tcl8.6/TkCmd/text.htm

Examples:
```python
import ttkbootstrap as ttk
from ttkbootstrap.constants import *
from ttkbootstrap.scrolled import ScrolledText
app = ttk.Window()
# scrolled text with autohide vertical scrollbar
st = ScrolledText(app, padding=5, height=10, autohide=True)
st.pack(fill=BOTH, expand=YES)
# add text
st.insert(END, 'Insert your text here.')
app.mainloop()
```
Source code in src/ttkbootstrap/widgets/scrolled.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | |
hbar
property
Return the internal horizontal scrollbar.
Returns:
Optional[ttk.Scrollbar]: The horizontal scrollbar, if created.
text
property
Return the internal text widget.
Returns:
ttk.Text: The underlying text widget instance.
vbar
property
Return the internal vertical scrollbar.
Returns:
Optional[ttk.Scrollbar]: The vertical scrollbar, if created.
__getattr__(name)
Delegate unknown attribute access to the internal Text widget.
This supports static type checkers by indicating that any missing
attribute on ScrolledText should be treated as Any and forwarded to
the underlying ttk.Text instance.
Source code in src/ttkbootstrap/widgets/scrolled.py
179 180 181 182 183 184 185 186 | |
__init__(master=None, padding=2, bootstyle=DEFAULT, autohide=False, vbar=True, hbar=False, **kwargs)
Parameters:
master (Widget):
The parent widget.
padding (int):
The amount of empty space to create on the outside of
the widget.
bootstyle (str):
A style keyword used to set the color and style of the
vertical scrollbar. Available options include -> primary,
secondary, success, info, warning, danger, dark, light.
vbar (bool):
A vertical scrollbar is shown when **True** (default).
hbar (bool):
A horizontal scrollbar is shown when **True**. Turning
on this scrollbar will also set `wrap="none"`. This
scrollbar is _off_ by default.
autohide (bool):
When **True**, the scrollbars will hide when the mouse
is not within the frame bbox.
**kwargs (dict[str, Any]):
Other keyword arguments passed to the `Text` widget.
Source code in src/ttkbootstrap/widgets/scrolled.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | |
autohide_scrollbar(*args)
Show the scrollbars when the mouse enters the widget frame, and hide when it leaves the frame.
Source code in src/ttkbootstrap/widgets/scrolled.py
240 241 242 243 244 | |
hide_scrollbars(*args)
Hide the scrollbars.
Source code in src/ttkbootstrap/widgets/scrolled.py
218 219 220 221 222 223 224 225 226 227 | |
show_scrollbars(*args)
Show the scrollbars.
Source code in src/ttkbootstrap/widgets/scrolled.py
229 230 231 232 233 234 235 236 237 238 | |