You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Network access is a common cause of slow handlers. If you try to retrieve a file from the internet, the message handler may take anything up to a few seconds to return, which would prevent the widget or app from updating during that time. The solution is to launch a new asyncio task to do the network task in the background.
asyncdefon_input_changed(self, message: Input.Changed) ->None:
"""A coroutine to handle a text changed message."""ifmessage.value:
# Look up the word in the backgroundasyncio.create_task(self.lookup_word(message.value))
else:
# Clear the resultsself.query_one("#results", Static).update()
As Will said on Discord:
It is still true, but if would definitely be a good place to induce workers!