-
-
Notifications
You must be signed in to change notification settings - Fork 993
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
The OptionList delays it's size calculation, which means that this code breaks.
I think we can refactor it to calculate the virtual size without so many intermediate messages.
from textual.app import App, ComposeResult
from textual.widgets import OptionList, Label
from textual.containers import VerticalScroll
from textual.message import Message
class Wizard(App):
def compose(self) -> ComposeResult:
with VerticalScroll(id = "body") as scroller:
scroller.can_focus = False
self.body = scroller
yield OptionList("yes","no")
async def ask_yes_no(self):
await self.body.mount_all([
Label("some text"),
query := OptionList("yes","no")
])
query.focus()
async def on_option_list_option_selected(self, message: OptionList.OptionSelected) -> None:
await message.option_list.remove()
await self.ask_yes_no()
self.body.scroll_end(animate=False)
if __name__ == "__main__":
Wizard().run()
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working