-
Notifications
You must be signed in to change notification settings - Fork 815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Select widget crashes if removed right after selected #4782
Comments
self.select.watch_value = self.on_select Whats the thinking behind monkey patching here? You may be right about the fix, but I wouldn't recommend adding a watcher like that. |
Right, this is the only way I could reproduce the bug in a minimal reproducible example. But I also saw it in a bigger project that is using @on(Select.Changed)
async def select_changed(self, event: Select.Changed) -> None:
while True:
await asyncio.sleep(0)
if not self.select.expanded:
break
self.select.remove() |
Got it. I'll have a fix for the next release. In the meantime, I'd recommend this as a workaround: def on_select(self):
self.call_later(self.select.remove) |
Don't forget to star the repository! Follow @textualizeio for Textual updates. |
The following code used to work, but now it crashes:
It seems that a check is needed before trying to hide the choices, in case the widget was removed.
Textual Diagnostics
Versions
Python
Operating System
Terminal
Rich Console options
The text was updated successfully, but these errors were encountered: