Closed yorevs closed 6 days ago
This sounds similar to https://github.com/Textualize/textual/issues/5137#issuecomment-2421626889, assuming you are using a thread worker?
This sounds similar to #5137 (comment), assuming you are using a thread worker?
Yes, Indeed I am. this is the function:
@work(thread=True, exclusive=True)
def ask_and_reply(self, question: str) -> tuple[bool, Optional[str]]:
self.enable_controls(False). # Here I toggle the line_input.loading = true/false
...
Similar to that issue, except that it's not inside on_mount. Actually, when it's inside it, it works.
The issue is that most Textual functions are not thread-safe (unrelated to on_mount). Try the suggested workaround in the thread worker docs.
The first difference [with thread workers] is that you should avoid calling methods on your UI directly, or setting reactive variables. You can work around this with the App.call_from_thread method which schedules a call in the main thread.
The issue is that most Textual functions are not thread-safe (unrelated to on_mount). Try the suggested workaround in the thread worker docs.
The first difference [with thread workers] is that you should avoid calling methods on your UI directly, or setting reactive variables. You can work around this with the App.call_from_thread method which schedules a call in the main thread.
Using call_from_thread solved the problem. Thanks. I will close the issue.
Don't forget to star the repository!
Follow @textualizeio for Textual updates.
Hello all,
After version 0.80.1 the LoadingIndicator of an Input component stopped working. This is the traceback:
Setting loading = true in another context:
If I rollback to 0.80.1 it works again.