dbpp.widgets package: GuiBaseClass - AutoScrollbar - Balloon - Ctext - LabEntry - RoText - Scrolled - SqlText - StatusBar - TableView - TextMixins - XTableView - XTreeView
dbpp.kroki - dbpp.kroki.KrokiEncoder - dbpp.utils - dbpp.utils.SqlUtils -
apps: dbpp.peditor
Provides ttk.Scrollbars for widgets with autohide functionality if not needed.
This a scrollbar which will hide itself if the widget for which they are configured do not acutally need scrollbars, for instance a text widget, where the current geometry is large enought to display all text. The widget and the the scrollbars will be gridded within the same geometry manager, so it usually required to place the scrollbars and the widget into the same frame without other widgets. This widget requires some effort to create scollbars, if you just like to have a simpler procedure to add those scrollbars use the Scrolled method.
Examples:
import tkinter as tk
import tkinter.ttk as ttk
from dbpp.widgets.autoscrollbar import AutoScrollbar
root=tk.Tk()
nframe=ttk.Frame(root)
tsbv=AutoScrollbar(nframe)
tsbh=AutoScrollbar(nframe,orient='horizontal')
text=tk.Text(nframe,
yscrollcommand=tsbv.set,
xscrollcommand=tsbh.set,wrap="none")
tsbv.grid(row=0, column=1, sticky='ns')
tsbh.grid(row=1, column=0, sticky='ew')
text.grid(row=0, column=0, sticky='nsew')
tsbv.config(command=text.yview)
tsbh.config(command=text.xview)
for i in range(0,30):
text.insert('end',"Hello Text ...
")
nframe.grid_rowconfigure(0, weight=1)
nframe.grid_columnconfigure(0, weight=1)
nframe.pack(side='top',fill='both',expand=True)
root.mainloop()
Copyright: @ Detlef Groth, 2023, Caputh-Schwielowsee
See also: Scrolled which provides an easier interface to this widget.
License: MIT
Provides scrollbars for tkinter widgets which are hidden if not needed.
Except for the constructor there is no method available for the AutoScrollbar class, at object instantiation. Simply provide the parent widget as usually and the standard arguments for ttk.Scrollbars. Only works if the target widget is managed by grid.
__init__(parent, *args, **kwargs)
Constructor for AutoScrollbar giving the parent widget where to place the scrollbar.
Args:
parent
(ttk.Widget): the parent widget wherein the scrollbar will be added*args (list)
: additional list arguments, usually not used**kwargs (dict)
: standard ttk.Scrollbar arguments which will be delegated to the ttk.Scrollbar, usually not used
pack(**kw)
Method should be not called directly.
place(**kw)
Method should be not called directly.
set(lo, hi)
Method should be not called directly.
This file was automatically generated via lazydocs.