ScrolledFrame
Bases: Frame
A widget container with a vertical scrollbar.
The ScrolledFrame fills the width with its container. The height is either set explicitly or is determined by the content frame's contents.
This widget behaves mostly like a normal frame other than the
exceptions stated already. Another exception is when packing it
into a Notebook or Panedwindow. In this case, you'll need to add
the container instead of the content frame. For example,
mynotebook.add(myscrolledframe.container).
The scrollbar has an autohide feature that can be turned on by
setting autohide=True.
Examples:
```python
import ttkbootstrap as ttk
from ttkbootstrap.constants import *
from ttkbootstrap.scrolled import ScrolledFrame
app = ttk.Window()
sf = ScrolledFrame(app, autohide=True)
sf.pack(fill=BOTH, expand=YES, padx=10, pady=10)
# add a large number of checkbuttons into the scrolled frame
for x in range(20):
ttk.Checkbutton(sf, text=f"Checkbutton {x}").pack(anchor=W)
app.mainloop()
```
Source code in src/ttkbootstrap/widgets/scrolled.py
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 | |
__init__(master=None, padding=2, bootstyle=DEFAULT, autohide=False, height=200, width=300, scrollheight=None, **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.
autohide (bool):
When **True**, the scrollbars will hide when the mouse
is not within the frame bbox.
height (int):
The height of the container frame in screen units.
width (int):
The width of the container frame in screen units.
scrollheight (int):
The height of the content frame in screen units. If None,
the height is determined by the frame contents.
**kwargs (dict[str, Any]):
Other keyword arguments passed to the content frame.
Source code in src/ttkbootstrap/widgets/scrolled.py
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 | |
autohide_scrollbar()
Toggle the autohide funtionality. 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
484 485 486 487 488 | |
disable_scrolling()
Disable mousewheel scrolling on the frame and all of its children.
Source code in src/ttkbootstrap/widgets/scrolled.py
471 472 473 474 | |
enable_scrolling()
Enable mousewheel scrolling on the frame and all of its children.
Source code in src/ttkbootstrap/widgets/scrolled.py
466 467 468 469 | |
hide_scrollbars()
Hide the scrollbars.
Source code in src/ttkbootstrap/widgets/scrolled.py
476 477 478 | |
show_scrollbars()
Show the scrollbars.
Source code in src/ttkbootstrap/widgets/scrolled.py
480 481 482 | |
yview(*args)
Update the vertical position of the content frame within the container.
Parameters:
*args (list[Any, ...]):
Optional arguments passed to yview in order to move the
content frame within the container frame.
Source code in src/ttkbootstrap/widgets/scrolled.py
378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 | |
yview_moveto(fraction)
Update the vertical position of the content frame within the container.
Parameters:
fraction (float):
The relative position of the content frame within the
container.
Source code in src/ttkbootstrap/widgets/scrolled.py
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 | |
yview_scroll(number, what)
Update the vertical position of the content frame within the container.
Parameters:
number (int):
The amount by which the content frame will be moved
within the container frame by 'what' units.
what (str):
The type of units by which the number is to be interpeted.
This parameter is currently not used and is assumed to be
'units'.
Source code in src/ttkbootstrap/widgets/scrolled.py
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 | |