From 3ce04c814a900fa7ee2d2835836832f80778b61c Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Tue, 23 May 2023 10:20:00 +0100 Subject: [PATCH] Add a method of selecting all selection options --- src/textual/widgets/_selection_list.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/textual/widgets/_selection_list.py b/src/textual/widgets/_selection_list.py index 018a8fdfd..846d0efe0 100644 --- a/src/textual/widgets/_selection_list.py +++ b/src/textual/widgets/_selection_list.py @@ -272,6 +272,10 @@ class SelectionList(Generic[SelectionType], OptionList): self.refresh() return self + def select_all(self) -> Self: + """Select all items.""" + return self._apply_to_all(self._select) + def _deselect(self, value: SelectionType) -> None: """Mark the given selection as not selected.