-
Notifications
You must be signed in to change notification settings - Fork 826
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 self.dark in on_load doesn't work: No Screens on stack #1369
Labels
bug
Something isn't working
Comments
Minimal code to demonstrate the issue: from textual.app import App, ComposeResult
from textual.containers import Container
from textual.widgets import Header, Footer
class EarlyDark( App[ None ] ):
CSS = """
Container {
background: $panel;
border: solid $panel-lighten-2;
}
"""
BINDINGS = [
( "d", "toggle", "Toggle Light/Dark" )
]
def compose( self ) -> ComposeResult:
yield Header()
yield Container()
yield Footer()
def action_toggle( self ) -> None:
self.dark = not self.dark
def on_load( self ) -> None:
self.dark = False
if __name__ == "__main__":
EarlyDark().run() The result of running this is the following error on startup:
|
davep
added a commit
to davep/textual
that referenced
this issue
Dec 21, 2022
This commit addresses Textualize#1369 by swallowing any `ScreenStackError` when calling `refresh_css` after setting the -{dark,light}-mode class on the app. The idea here being that if there is no screen, that's fine, the style will be taken up once there is one.
Fixed by #1421. |
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
Suspect we could make this work.
The text was updated successfully, but these errors were encountered: