Skip to content

self.watch causes asynchronous callbacks to run synchronously #3171

Answered by willmcgugan
mzebrak asked this question in Q&A
Discussion options

You must be logged in to vote

What I would expect is that all 3 DynamicLabels will be waiting at the same time and each of them will update after 1 second

All callbacks are serialized with the widget's message queue. You almost always want this. If Textual launched tasks for such things, it would make it next to impossible to predict the state of your app from one call to the next. If you do want concurrency, you can use Textual's Workers.

Because in this way we lose the ability to set CSS for DynamicLabel, e.g. text-align: center and we have to set it for DynamicLabel Label

CSS types in Textual will work down the widget's MRO. So the CSS from the base class still applies.

n the CSS along with width: 100% because…

Replies: 3 comments 9 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
9 replies
@mzebrak
Comment options

@willmcgugan
Comment options

@mzebrak
Comment options

@willmcgugan
Comment options

@mzebrak
Comment options

Answer selected by davep
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
Converted from issue

This discussion was converted from issue #3163 on August 24, 2023 18:52.