From c2e406e48a6e7c897d97d76883b9e4288ff30b14 Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Mon, 23 Jan 2023 15:09:22 +0000 Subject: [PATCH] Explain the significance of the before/after types This was asked about on Discord; reading the docs over again it's not obvious what an `int` is for, or a `str`. This change seeks to explain things at the API level at least. --- src/textual/widget.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/textual/widget.py b/src/textual/widget.py index 59b0c1ee2a..5e208d208d 100644 --- a/src/textual/widget.py +++ b/src/textual/widget.py @@ -557,8 +557,12 @@ def mount( Args: *widgets: The widget(s) to mount. - before: Optional location to mount before. - after: Optional location to mount after. + before: Optional location to mount before. An `int` is the index + of the child to mount before, a `str` is a `query_one` query to + find the widget to mount before. + after: Optional location to mount after. An `int` is the index + of the child to mount after, a `str` is a `query_one` query to + find the widget to mount after. Returns: An awaitable object that waits for widgets to be mounted. @@ -618,8 +622,12 @@ def move_child( Args: child: The child widget to move. - before: Optional location to move before. - after: Optional location to move after. + before: Optional location to move before. An `int` is the index + of the child to move before, a `str` is a `query_one` query to + find the widget to move before. + after: Optional location to move after. An `int` is the index + of the child to move after, a `str` is a `query_one` query to + find the widget to move after. Raises: WidgetError: If there is a problem with the child or target.