CheckboxTreeview¶
-
class
ttkwidgets.CheckboxTreeview(master=None, **kw)[source]¶ Bases:
ttk.Treeviewttk.Treeviewwidget with checkboxes left of each item.Note
The checkboxes are done via the image attribute of the item, so to keep the checkbox, you cannot add an image to the item.
-
__init__(master=None, **kw)[source]¶ Create a CheckboxTreeview.
Parameters: - master (widget) – master widget
- kw – options to be passed on to the
ttk.Treeviewinitializer
-
change_state(item, state)[source]¶ Replace the current state of the item.
i.e. replace the current state tag but keeps the other tags.
Parameters: - item (str) – item id
- state (str) – “checked”, “unchecked” or “tristate”: new state of the item
-
insert(parent, index, iid=None, **kw)[source]¶ Creates a new item and return the item identifier of the newly created item.
Parameters: - parent (str) – identifier of the parent item
- index (int or "end") – where in the list of parent’s children to insert the new item
- iid (None or str) – item identifier, iid must not already exist in the tree. If iid is None a new unique identifier is generated.
- kw – other options to be passed on to the
ttk.Treeview.insert()method
Returns: the item identifier of the newly created item
Return type: str
Note
Same method as for the standard
ttk.Treeviewbut add the tag for the box state accordingly to the parent state if no tag among (‘checked’, ‘unchecked’, ‘tristate’) is given.
-
state(statespec=None)[source]¶ Modify or inquire widget state.
Parameters: statespec (None or sequence[str]) – Widget state is returned if statespec is None, otherwise it is set according to the statespec flags and then a new state spec is returned indicating which flags were changed.
-