Skip to content

Textual 0.14.0 shakes up posting messages

Textual version 0.14.0 has landed just a week after 0.13.0.


We like fast releases for Textual. Fast releases means quicker feedback, which means better code.

What's new?

We did a little shake-up of posting messages which will simplify building widgets. But this does mean a few breaking changes.

There are two methods in Textual to post messages: post_message and post_message_no_wait. The former was asynchronous (you needed to await it), and the latter was a regular method call. These two methods have been replaced with a single post_message method.

To upgrade your project to Textual 0.14.0, you will need to do the following:

  • Remove await keywords from any calls to post_message.
  • Replace any calls to post_message_no_wait with post_message.

Additionally, we've simplified constructing messages classes. Previously all messages required a sender argument, which had to be manually set. This was a clear violation of our "no boilerplate" policy, and has been dropped. There is still a sender property on messages / events, but it is set automatically.

So prior to 0.14.0 you might have posted messages like the following:

await self.post_message(self.Changed(self, item=self.item))

You can now replace it with this simpler function call:


This also means that you will need to drop the sender from any custom messages you have created.

If this was code pre-0.14.0:

class MyWidget(Widget):

    class Changed(Message):
        """My widget change event."""
        def __init__(self, sender:MessageTarget, item_index:int) -> None:
            self.item_index = item_index

You would need to make the following change (dropping sender).

class MyWidget(Widget):

    class Changed(Message):
        """My widget change event."""
        def __init__(self, item_index:int) -> None:
            self.item_index = item_index

If you have any problems upgrading, join our Discord server, we would be happy to help.

See the release notes for the full details on this update.