Skip to content
Discussion options

You must be logged in to vote

There's a couple of different problems with your code. First off, Textual widgets have a name and an id property anyway, so if you're overriding the __init__ and you want to use those you'll need to pass them to the super().__init__ call. Secondly, when you instantiate your Text widget, which inherits from Static, you're passing more positional arguments than Static's __init__ is designed to take; it has only the one positional argument, the rest are keyword arguments.

A clean starting point for your code would be something like this:

from textual.app import App, ComposeResult
from textual.widgets import Static, ListView, ListItem, Header, Footer


class Demo(App[None]):
    def compose(self

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Tim-Cao
Comment options

@davep
Comment options

@Tim-Cao
Comment options

Answer selected by Tim-Cao
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