From 0dc58bd15195f93fb8d2a49d209797acfdb7bc21 Mon Sep 17 00:00:00 2001 From: darrenburns Date: Wed, 31 May 2023 09:45:06 +0100 Subject: [PATCH] Ensure _options attribute is assigned in Select constructor (#2690) * Ensure _options attribute is assigned in Select constructor * Update CHANGELOG.md --------- Co-authored-by: Will McGugan --- CHANGELOG.md | 1 + src/textual/widgets/_select.py | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0da63d0a..041976d33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Fixed zero division error https://github.com/Textualize/textual/issues/2673 - Fix `scroll_to_center` when there were nested layers out of view (Compositor full_map not populated fully) https://github.com/Textualize/textual/pull/2684 +- Fix crash when `Select` widget value attribute was set in `compose` https://github.com/Textualize/textual/pull/2690 - Issue with computing progress in workers https://github.com/Textualize/textual/pull/2686 - Issues with `switch_screen` not updating the results callback appropriately https://github.com/Textualize/textual/issues/2650 diff --git a/src/textual/widgets/_select.py b/src/textual/widgets/_select.py index 2038a46a5..ce667f526 100644 --- a/src/textual/widgets/_select.py +++ b/src/textual/widgets/_select.py @@ -273,6 +273,7 @@ class Select(Generic[SelectType], Vertical, can_focus=True): self.prompt = prompt self._initial_options = list(options) self._value: SelectType | None = value + self._options = options def set_options(self, options: Iterable[tuple[RenderableType, SelectType]]) -> None: """Set the options for the Select.