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

Both parent's and child's [on_mount] method are called in runtime #4112

Closed
jasonlkh-wa opened this issue Feb 3, 2024 · 3 comments
Closed

Comments

@jasonlkh-wa
Copy link

Defining an [on_mount] method in the child class would cause [on_mount] method being called from both the parent and the child class.

e.g.

# During runtime, both messages will be printed
class Parent(App):
    def on_mount(self):
        print("triggered")
        
class Child(Parent):
    def on_mount(self):
        print("triggered in child")
@TomJGooding
Copy link
Contributor

I think this is intentional, see https://textual.textualize.io/guide/events/#default-behaviors

@Textualize Textualize deleted a comment from github-actions bot Feb 3, 2024
@jasonlkh-wa
Copy link
Author

Ah sorry my bad, thanks a lot!

Copy link

github-actions bot commented Feb 3, 2024

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

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

No branches or pull requests

2 participants