THE BIG SELECTOR BOX

A Tkinter text widget based option selector

Copyright (c) 2020, Antal Koós
License: MIT


Use

mouse buttons on item:

mouse buttons on group separator:

Selecting with dragging the mouse and clicking on “Select/Unselect all” acts only on the selected items.

import tkinter as tk
import thebigselector as tbs
    ...
bsb= tbs.BigSelBox(win, items= items, callback= cb, intro= intro, see="items_start")
    ...

See the demos for the details!



BigSelBox


BigSelBox is an option selector, derived from ttk.Frame and contains a tk.Text widget associated with a vertical ttk.Scrollbar.

BigSelBox(  master, items=[], selections=[], callback=None,
            separators={}, sepprops={}, textprops={},
            frameprops={}, itemprops={},
            pickedprops={}, intro=" ", introprops={},
            compl=" ", complprops={}, see=None)

Args:

Attributes:

The callback can be set two ways, e.g.: sb.callback=cb or sb["callback"]=cb

Methods:

set_items(items,selections=[], see=None): sets the items.

set_selections(selections, see=None): sets the selections.

set_intro(txt, see=None): sets the introductory text.

set_compl(txt, see=None): sets the completion text.

see(self,index): scrolls the text until the part on that position is visible.

disable_button(btnstr): disables/enables a button.
enable_button(btnstr): disables/enables a button.



TopBSB


A Tkinter top level window class with a ‘BigSelBox’ inside.

TopBSB(parent, items=[], selections=[], callback=None,
    separators={}, sepprops={}, textprops={},
    frameprops={}, itemprops={},
    pickedprops={}, intro="", introprops={},
    compl="", complprops={},
    **toplevel_kwargs)

Args:

The other args will be passed to the inner BigSelBox instance.
When the window is destroyed, the callback also will be called with (box, actnCancel, None).



Module utilities


geom(wdg): returns the widget’s geometry values as ints: (width, height, x, y).

fix_minsize(wdg): freezes the widget size to the recommended minimal size.