Skip to content
Discussion options

You must be logged in to vote

If you have a collection of widgets, that would suggest they're inside a container of some sort. When that container gets its on_mount message, the children will be mounted.

You could explore this with something like this:

from dataclasses import dataclass

from textual import on
from textual.app import App, ComposeResult
from textual.containers import Horizontal, VerticalScroll
from textual.message import Message
from textual.widget import Widget
from textual.widgets import Button, Log

@dataclass
class CountMessage(Message):
    widget: Widget

class CheckingButton(Button):

    def on_mount(self) -> None:
        self.post_message(CountMessage(self))

class CollectionOfWidgets(Vertical…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by MohamedElgamal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants