diff --git a/docs/blog/posts/on-dog-food-the-original-metaverse-and-not-being-bored.md b/docs/blog/posts/on-dog-food-the-original-metaverse-and-not-being-bored.md index 076cb96b5..494105cfb 100644 --- a/docs/blog/posts/on-dog-food-the-original-metaverse-and-not-being-bored.md +++ b/docs/blog/posts/on-dog-food-the-original-metaverse-and-not-being-bored.md @@ -288,7 +288,7 @@ So, thanks to this bit of code in my `Activity` widget... parent.move_child( self, before=parent.children.index( self ) - 1 ) - self.emit_no_wait( self.Moved( self ) ) + self.post_messa_no_wait( self.Moved( self ) ) self.scroll_visible( top=True ) ``` diff --git a/docs/examples/events/custom01.py b/docs/examples/events/custom01.py index 043b32ffc..c96f2e0a9 100644 --- a/docs/examples/events/custom01.py +++ b/docs/examples/events/custom01.py @@ -25,8 +25,8 @@ class ColorButton(Static): self.styles.border = ("tall", self.color) async def on_click(self) -> None: - # The emit method sends an event to a widget's parent - await self.emit(self.Selected(self, self.color)) + # The post_message method sends an event to be handled in the DOM + await self.post_message(self.Selected(self, self.color)) def render(self) -> str: return str(self.color) diff --git a/docs/guide/events.md b/docs/guide/events.md index 2fa5195c2..cefe87de2 100644 --- a/docs/guide/events.md +++ b/docs/guide/events.md @@ -110,7 +110,7 @@ The message class is defined within the widget class itself. This is not strictl ## Sending events -In the previous example we used [emit()][textual.message_pump.MessagePump.emit] to send an event to its parent. We could also have used [emit_no_wait()][textual.message_pump.MessagePump.emit_no_wait] for non async code. Sending messages in this way allows you to write custom widgets without needing to know in what context they will be used. +In the previous example we used [post_message()][textual.message_pump.MessagePump.post_message] to send an event to its parent. We could also have used [post_message_no_wait()][textual.message_pump.MessagePump.post_message_no_wait] for non async code. Sending messages in this way allows you to write custom widgets without needing to know in what context they will be used. There are other ways of sending (posting) messages, which you may need to use less frequently.