diff --git a/setup.py b/setup.py index 91bf2325..3a554690 100644 --- a/setup.py +++ b/setup.py @@ -70,7 +70,7 @@ setuptools.setup( name="ttkbootstrap", - version="1.7.7.1", + version="1.7.7.2", author="Israel Dryer", author_email="israel.dryer@gmail.com", description="A supercharged theme extension for tkinter that enables on-demand modern flat style themes inspired by Bootstrap.", diff --git a/src/ttkbootstrap/tableview.py b/src/ttkbootstrap/tableview.py index 24af3699..e05f0925 100644 --- a/src/ttkbootstrap/tableview.py +++ b/src/ttkbootstrap/tableview.py @@ -1153,9 +1153,13 @@ def get_column( except ValueError: return None - def get_rows(self, visible=False, filtered=False) -> List[TableRow]: + def get_rows(self, visible=False, filtered=False, selected=False) -> List[TableRow]: """Return a list of TableRow objects. + Return a subset of rows based on optional flags. Only ONE flag can be used + at a time. If more than one flag is set to `True`, then the first flag will + be used to return the data. + Parameters: visible (bool): @@ -1164,6 +1168,9 @@ def get_rows(self, visible=False, filtered=False) -> List[TableRow]: filtered (bool): If True, only rows in the filtered dataset will be returned. + selected (bool): + If True, only rows that are currently selected will be returned. + Returns: List[TableRow]: @@ -1173,6 +1180,8 @@ def get_rows(self, visible=False, filtered=False) -> List[TableRow]: return self._viewdata elif filtered: return self._tablerows_filtered + elif selected: + return [row for row in self._viewdata if row.iid in self.view.selection()] else: return self._tablerows