Skip to content
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

Make on_mount callback customizable #102

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gitseti
Copy link

@gitseti gitseti commented Dec 29, 2024

Introduce the ability to customize the on_mount callback of the underlying Textual App. By allowing users to specify the on_mount behavior, they can define their own logic for the application's mount phase. For example, users can change the default theme of the generated Trogon app.

I wasn't entirely sure if this behavior could be achieved in a different way, so I implemented it using the on_mount callback. However, I'm open to adjust the implementation if there's a more idiomatic or better approach to achieve the same result.

Example: Change default theme

def on_mount(app: App):
    app.theme = 'tokyo-night'

@tui(on_mount=on_mount)
@click.command()
def hello_world():
    """Prints 'Hello world'."""
    click.echo('Hello world.')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant