Skip to content
Discussion options

You must be logged in to vote

You will need to pass through the id to the constructor of the base class. Something like this:

class SayWord(Static):
    """
    Simple little widget to say a word
    """

    def __init__(self, word: str = "", id: str = "") -> None:
        self.word = word
        super().__init__(id=id)

    def compose(self) -> ComposeResult:
        yield Label(f"I have to say: {self.word}")

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jessebot
Comment options

Answer selected by jessebot
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