-
Notifications
You must be signed in to change notification settings - Fork 829
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
Setting theme doesn't work a second time #2583
Comments
class Test:
dark = True
def __init__(self) -> None:
self.dark = False
test = Test()
print(test.dark) # False
print(Test.dark) # True |
Generally I'd recommend setting reactives in a message handler. If you set dark to False in That said, I don't have an explanation for the behaviour in the issue. Does look like something is being associated with the class rather than the instance. |
@TomJGooding , @willmcgugan Thanks for the explanations. |
Sorry ankraft if I've mislead you - Will seems to have put me straight and already opened a PR for this. |
@TomJGooding No problem. Thanks for taking the time. And it's great to see a PR so quickly! |
Don't forget to star the repository! Follow @textualizeio for Textual updates. |
This is a rather strange one. I have a textual app that may be run multiple times from a parent app (all in the same Python runtime), but not in parallel.
What I am doing is to instantiate a new App instance every time and run() it. Now, when I set the theme mode (
self.dark = False
) in the__init()__
method, from the second instantiation on the theme doesn't change. However, if I assign toself.dark
in thecompose()
method everything works fine.The example code:
The text was updated successfully, but these errors were encountered: