From b01dd52576655e2077a2b5369232af0ffb40d012 Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Sat, 11 May 2024 12:10:54 +0100 Subject: [PATCH] Deployed a70636444 with MkDocs version: 1.5.3 --- api/app/index.html | 60 ++- api/binding/index.html | 8 +- api/color/index.html | 2 +- api/command/index.html | 12 +- api/containers/index.html | 2 +- api/content_switcher/index.html | 2 +- api/dom_node/index.html | 2 +- api/geometry/index.html | 26 +- api/message_pump/index.html | 42 ++ api/screen/index.html | 6 +- api/signal/index.html | 38 +- api/suggester/index.html | 2 +- api/timer/index.html | 48 ++ api/types/index.html | 2 +- api/validation/index.html | 6 +- api/widget/index.html | 79 ++- api/worker/index.html | 10 +- feed_rss_created.xml | 2 +- feed_rss_updated.xml | 2 +- guide/app/index.html | 4 + guide/queries/index.html | 59 ++- guide/reactivity/index.html | 574 +++++++++++----------- guide/widgets/index.html | 123 ++--- guide/workers/index.html | 2 + how-to/render-and-compose/index.html | 688 +++++++++++++-------------- objects.inv | Bin 12345 -> 12371 bytes search/search_index.json | 2 +- sitemap.xml | 540 ++++++++++----------- sitemap.xml.gz | Bin 2576 -> 2577 bytes tutorial/index.html | 530 ++++++++++----------- widget_gallery/index.html | 116 ++--- widgets/button/index.html | 3 +- widgets/content_switcher/index.html | 2 +- widgets/data_table/index.html | 4 +- widgets/digits/index.html | 110 ++--- widgets/directory_tree/index.html | 2 +- widgets/header/index.html | 2 +- widgets/input/index.html | 6 +- widgets/list_item/index.html | 2 +- widgets/list_view/index.html | 6 +- widgets/loading_indicator/index.html | 116 ++--- widgets/markdown/index.html | 6 +- widgets/markdown_viewer/index.html | 10 +- widgets/option_list/index.html | 24 +- widgets/progress_bar/index.html | 4 +- widgets/radiobutton/index.html | 2 +- widgets/radioset/index.html | 2 +- widgets/select/index.html | 8 +- widgets/selection_list/index.html | 2 +- widgets/sparkline/index.html | 2 +- widgets/switch/index.html | 4 +- widgets/tabbed_content/index.html | 4 +- widgets/tabs/index.html | 4 +- widgets/text_area/index.html | 50 +- widgets/tree/index.html | 12 +- 55 files changed, 1798 insertions(+), 1578 deletions(-) diff --git a/api/app/index.html b/api/app/index.html index 466bda5686..86c42ab2ca 100644 --- a/api/app/index.html +++ b/api/app/index.html @@ -5790,6 +5790,15 @@ + + +
  • + + + render() + + +
  • @@ -8340,6 +8349,15 @@ +
  • + +
  • + + + render() + + +
  • @@ -9015,8 +9033,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -9041,8 +9059,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -9141,8 +9159,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -9165,8 +9183,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -9189,8 +9207,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -9219,7 +9237,7 @@

    -
    app_resume_signal = Signal(self, 'app-resume')
    +
    app_resume_signal: Signal[App] = Signal(self, 'app-resume')
     
    @@ -9247,7 +9265,9 @@

    -
    app_suspend_signal = Signal(self, 'app-suspend')
    +
    app_suspend_signal: Signal[App] = Signal(
    +    self, "app-suspend"
    +)
     
    @@ -9362,8 +9382,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -13312,6 +13332,30 @@
    Raises
    +

    + render + + + method + + +

    +
    def render(self):
    +
    + +
    + +

    Render method inherited from widget, to render the screen's background.

    +

    May be override to customize background visuals.

    + +
    + +
    + +
    + + +

    run diff --git a/api/binding/index.html b/api/binding/index.html index 8c592a0a44..77479d3982 100644 --- a/api/binding/index.html +++ b/api/binding/index.html @@ -6626,8 +6626,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -6673,8 +6673,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -6697,8 +6697,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -6721,8 +6721,8 @@

    - instance-attribute class-attribute + instance-attribute

    diff --git a/api/color/index.html b/api/color/index.html index 51ff11e159..4362d9ead5 100644 --- a/api/color/index.html +++ b/api/color/index.html @@ -8129,8 +8129,8 @@

    - instance-attribute class-attribute + instance-attribute

    diff --git a/api/command/index.html b/api/command/index.html index a76047068c..1e8b39a383 100644 --- a/api/command/index.html +++ b/api/command/index.html @@ -7803,8 +7803,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -7850,8 +7850,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -7943,8 +7943,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -8037,8 +8037,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -8672,8 +8672,8 @@

    search - async abstractmethod + async

    @@ -8830,8 +8830,8 @@

    - instance-attribute class-attribute + instance-attribute

    diff --git a/api/containers/index.html b/api/containers/index.html index f5b82a89fc..9de9e48bfc 100644 --- a/api/containers/index.html +++ b/api/containers/index.html @@ -7292,8 +7292,8 @@

    - instance-attribute class-attribute + instance-attribute

    diff --git a/api/content_switcher/index.html b/api/content_switcher/index.html index 91a94b1ef2..280df5bcf2 100644 --- a/api/content_switcher/index.html +++ b/api/content_switcher/index.html @@ -6557,8 +6557,8 @@

    - instance-attribute class-attribute + instance-attribute

    diff --git a/api/dom_node/index.html b/api/dom_node/index.html index 8abd6963ef..5e7144bbb2 100644 --- a/api/dom_node/index.html +++ b/api/dom_node/index.html @@ -7678,8 +7678,8 @@

    - instance-attribute class-attribute + instance-attribute

    diff --git a/api/geometry/index.html b/api/geometry/index.html index 1c1afd326d..e5f531abd8 100644 --- a/api/geometry/index.html +++ b/api/geometry/index.html @@ -8154,8 +8154,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -8178,8 +8178,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -8734,8 +8734,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -8974,8 +8974,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -8998,8 +8998,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -9022,8 +9022,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -10826,8 +10826,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -10896,8 +10896,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -10930,7 +10930,7 @@

    -

    Clamp an offset to fit within the width x heigh.

    +

    Clamp an offset to fit within the width x height.

    Parameters
    @@ -11325,8 +11325,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -11419,8 +11419,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -11443,8 +11443,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -11467,8 +11467,8 @@

    - instance-attribute class-attribute + instance-attribute

    diff --git a/api/message_pump/index.html b/api/message_pump/index.html index 77b94cd9a3..ab60c2d380 100644 --- a/api/message_pump/index.html +++ b/api/message_pump/index.html @@ -5403,6 +5403,15 @@ + + +
  • + + + message_signal + + +
  • @@ -6594,6 +6603,15 @@ +
  • + +
  • + + + message_signal + + +
  • @@ -7011,6 +7029,30 @@

    + + + +

    + message_signal + + + + instance-attribute + + +

    +
    message_signal: Signal[Message] = Signal(self, 'messages')
    +
    + +
    + +

    Subscribe to this signal to be notified of all messages sent to this widget.

    +

    This is a fairly low-level mechanism, and shouldn't replace regular message handling.

    +
    + + +
    diff --git a/api/screen/index.html b/api/screen/index.html index b80134ee59..7bfa46f324 100644 --- a/api/screen/index.html +++ b/api/screen/index.html @@ -7591,8 +7591,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -7706,7 +7706,7 @@

    -
    screen_layout_refresh_signal = Signal(
    +
    screen_layout_refresh_signal: Signal[Screen] = Signal(
         self, "layout-refresh"
     )
     
    @@ -7727,8 +7727,8 @@

    - instance-attribute class-attribute + instance-attribute

    diff --git a/api/signal/index.html b/api/signal/index.html index 9de959481f..ff2abbffab 100644 --- a/api/signal/index.html +++ b/api/signal/index.html @@ -6383,6 +6383,8 @@

    +

    + Bases: Generic[SignalT]

    A signal that a widget may subscribe to, in order to invoke callbacks when an associated event occurs.

    @@ -6403,7 +6405,7 @@
    Parameters
  • - +
    owner
    - DOMNode + MessagePump
    required @@ -6449,13 +6451,37 @@

    -
    def publish(self):
    +
    def publish(self, data):
     

    Publish the signal (invoke subscribed callbacks).

    +
    Parameters
    + + + + + + + + + + + + + + + +
    ParameterDefaultDescription
    + data +
    + SignalT +
    + required +

    An argument to pass to the callbacks.

    +
    @@ -6494,7 +6520,7 @@
    Parameters
    node
    - DOMNode + MessagePump
    required @@ -6505,12 +6531,12 @@
    Parameters
    callback
    - IgnoreReturnCallbackType + SignalCallbackType
    required

    A callback function which takes no arguments, and returns anything (return type ignored).

    A callback function which takes a single argument and returns anything (return type ignored).

    @@ -6570,7 +6596,7 @@
    Parameters
    node
    - DOMNode + MessagePump required diff --git a/api/suggester/index.html b/api/suggester/index.html index fb2dd47250..22bb267a82 100644 --- a/api/suggester/index.html +++ b/api/suggester/index.html @@ -6822,8 +6822,8 @@

    get_suggestion - async abstractmethod + async

    diff --git a/api/timer/index.html b/api/timer/index.html index c6922db07e..f5200cdf88 100644 --- a/api/timer/index.html +++ b/api/timer/index.html @@ -5612,6 +5612,15 @@ +

  • + +
  • + + + EventTargetGone + + +
  • @@ -6395,6 +6404,15 @@ +
  • + +
  • + + + EventTargetGone + + +
  • @@ -6519,6 +6537,36 @@

    +

    + EventTargetGone + + + + class + + +

    + + +
    +

    + Bases: Exception

    + + +

    Raised if the timer event target has been deleted prior to the timer event being sent.

    + + + +
    + + + +
    + + + + +

    Timer diff --git a/api/types/index.html b/api/types/index.html index a78084ba00..180a946311 100644 --- a/api/types/index.html +++ b/api/types/index.html @@ -7478,8 +7478,8 @@

    - instance-attribute class-attribute + instance-attribute

    diff --git a/api/validation/index.html b/api/validation/index.html index ecb5c5df29..9d4e5a3a68 100644 --- a/api/validation/index.html +++ b/api/validation/index.html @@ -7400,8 +7400,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -7447,8 +7447,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -8999,8 +8999,8 @@

    - instance-attribute class-attribute + instance-attribute

    diff --git a/api/widget/index.html b/api/widget/index.html index 3d72262540..2c785144c3 100644 --- a/api/widget/index.html +++ b/api/widget/index.html @@ -6882,6 +6882,15 @@ +
  • + +
  • + + + suppress_click() + + +
  • @@ -8757,6 +8766,15 @@ +
  • + +
  • + + + suppress_click() + + +
  • @@ -9282,8 +9300,8 @@ @@ -9306,8 +9324,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -9330,8 +9348,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -9354,8 +9372,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -9378,8 +9396,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -9672,8 +9690,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -9760,8 +9778,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -9784,8 +9802,8 @@ @@ -9853,8 +9871,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -10204,8 +10222,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -10300,8 +10318,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -10536,8 +10554,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -10562,8 +10580,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -10861,8 +10879,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -10887,8 +10905,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -10913,8 +10931,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -11172,8 +11190,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -13291,6 +13309,8 @@

    Applies style attributes to the default renderable.

    +

    This method is called by Textual itself. +It is unlikely you will need to call or implement this method.

    Returns
    @@ -16189,6 +16209,31 @@
    Parameters
    +

    + suppress_click + + + method + + +

    +
    def suppress_click(self):
    +
    + +
    + +

    Suppress a click event.

    +

    This will prevent a Click event being sent, +if called after a mouse down event and before the click itself.

    + +
    + + + +
    + + +

    watch_disabled diff --git a/api/worker/index.html b/api/worker/index.html index 2327da93b6..31bbf4bf81 100644 --- a/api/worker/index.html +++ b/api/worker/index.html @@ -7953,8 +7953,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -7977,8 +7977,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -8001,8 +8001,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -8025,8 +8025,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -8049,8 +8049,8 @@

    - instance-attribute class-attribute + instance-attribute

    diff --git a/feed_rss_created.xml b/feed_rss_created.xml index d74dc670e1..acbf00920c 100644 --- a/feed_rss_created.xml +++ b/feed_rss_created.xml @@ -1 +1 @@ - Textualhttps://textual.textualize.io/https://github.com/textualize/textual/en Sun, 21 Apr 2024 12:21:59 -0000 Sun, 21 Apr 2024 12:21:59 -0000 1440 MkDocs RSS plugin - v1.12.1 Behind the Curtain of Inline Terminal Applications willmcgugan DevLog <h1>Behind the Curtain of Inline Terminal Applications</h1><p>Textual recently added the ability to run <em>inline</em> terminal apps.You can see this in action if you run the <a href="https://github.com/Textualize/textual/blob/main/examples/calculator.py">calculator example</a>:</p><p><img alt="Inline Calculator" src="../images/calcinline.png"></p><p>The application appears directly under the prompt, rather than occupying the full height of the screen&mdash;which is more typical of TUI applications.You can interact with this calculator using keys <em>or</em> the mouse.When you press ++ctrl+c++ the calculator disappears and returns you to the prompt.</p><p>Here's another app that creates an inline code editor:</p><p>=== "Video"</p><pre><code>&lt;div class="video-wrapper"&gt; &lt;iframe width="852" height="525" src="https://www.youtube.com/embed/Dt70oSID1DY" title="Inline app" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen&gt;&lt;/iframe&gt;&lt;/div&gt;</code></pre><p>=== "inline.py" ```python from textual.app import App, ComposeResult from textual.widgets import TextArea</p><pre><code>class InlineApp(App): CSS = """ TextArea { height: auto; max-height: 50vh; } """ def compose(self) -&gt; ComposeResult: yield TextArea(language="python")if __name__ == "__main__": InlineApp().run(inline=True)```</code></pre><p>This post will cover some of what goes on under the hood to make such inline apps work.</p><p>It's not going to go in to too much detail.I'm assuming most readers will be more interested in a birds-eye view rather than all the gory details.</p>https://textual.textualize.io/blog/2024/04/20/behind-the-curtain-of-inline-terminal-applications/ Sat, 20 Apr 2024 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2024/04/20/behind-the-curtain-of-inline-terminal-applications/ Remote memory profiling with Memray willmcgugan DevLog <h1>Remote memory profiling with Memray</h1><p><a href="https://github.com/bloomberg/memray">Memray</a> is a memory profiler for Python, built by some very smart devs at Bloomberg.It is a fantastic tool to identify memory leaks in your code or other libraries (down to the C level)!</p><p>They recently added a <a href="https://github.com/textualize/textual/">Textual</a> interface which looks amazing, and lets you monitor your process right from the terminal:</p><p><img alt="Memray" src="https://raw.githubusercontent.com/bloomberg/memray/main/docs/_static/images/live_animated.webp"></p>https://textual.textualize.io/blog/2024/02/20/remote-memory-profiling-with-memray/ Tue, 20 Feb 2024 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2024/02/20/remote-memory-profiling-with-memray/ File magic with the Python standard library willmcgugan DevLog <h1>File magic with the Python standard library</h1><p>I recently published <a href="https://github.com/textualize/toolong">Toolong</a>, an app for viewing log files.There were some interesting technical challenges in building Toolong that I'd like to cover in this post.</p>https://textual.textualize.io/blog/2024/02/11/file-magic-with-the-python-standard-library/ Sun, 11 Feb 2024 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2024/02/11/file-magic-with-the-python-standard-library/ Announcing textual-plotext davep DevLog <h1>Announcing textual-plotext</h1><p>It's no surprise that a common question on the <a href="https://discord.gg/Enf6Z3qhVr">Textual Discordserver</a> is how to go about producing plots inthe terminal. A popular solution that has been suggested is<a href="https://github.com/piccolomo/plotext">Plotext</a>. While Plotext doesn'tdirectly support Textual, it is <a href="https://github.com/piccolomo/plotext/blob/master/readme/environments.md#rich">easy to use withRich</a>and, because of this, we wanted to make it just as easy to use in yourTextual applications.</p>https://textual.textualize.io/blog/2023/10/04/announcing-textual-plotext/ Wed, 04 Oct 2023 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2023/10/04/announcing-textual-plotext/ Textual 0.38.0 adds a syntax aware TextArea willmcgugan Release <h1>Textual 0.38.0 adds a syntax aware TextArea</h1><p>This is the second big feature release this month after last week's <a href="./release0.37.0.md">command palette</a>.</p>https://textual.textualize.io/blog/2023/09/21/textual-0380-adds-a-syntax-aware-textarea/ Thu, 21 Sep 2023 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2023/09/21/textual-0380-adds-a-syntax-aware-textarea/ Things I learned while building Textual's TextArea darrenburns DevLog <h1>Things I learned building a text editor for the terminal</h1><p><code>TextArea</code> is the latest widget to be added to Textual's <a href="https://textual.textualize.io/widget_gallery/">growing collection</a>.It provides a multi-line space to edit text, and features optional syntax highlighting for a selection of languages.</p><p><img alt="text-area-welcome.gif" src="../images/text-area-learnings/text-area-welcome.gif"></p><p>Adding a <code>TextArea</code> to your Textual app is as simple as adding this to your <code>compose</code> method:</p><p><code>pythonyield TextArea()</code></p><p>Enabling syntax highlighting for a language is as simple as:</p><p><code>pythonyield TextArea(language="python")</code></p><p>Working on the <code>TextArea</code> widget for Textual taught me a lot about Python and my generalapproach to software engineering. It gave me an appreciation for the subtle functionality behindthe editors we use on a daily basis — features we may not even notice, despitesome engineer spending hours perfecting it to provide a small boost to our development experience.</p><p>This post is a tour of some of these learnings.</p>https://textual.textualize.io/blog/2023/09/18/things-i-learned-while-building-textuals-textarea/ Mon, 18 Sep 2023 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2023/09/18/things-i-learned-while-building-textuals-textarea/ Textual 0.37.0 adds a command palette willmcgugan Release <h1>Textual 0.37.0 adds a command palette</h1><p>Textual version 0.37.0 has landed!The highlight of this release is the new command palette.</p>https://textual.textualize.io/blog/2023/09/15/textual-0370-adds-a-command-palette/ Fri, 15 Sep 2023 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2023/09/15/textual-0370-adds-a-command-palette/ What is Textual Web? willmcgugan News <h1>What is Textual Web?</h1><p>If you know us, you will know that we are the team behind <a href="https://github.com/Textualize/rich">Rich</a> and <a href="https://github.com/Textualize/textual">Textual</a> &mdash; two popular Python libraries that work magic in the terminal.</p><p>!!! note</p><pre><code>Not to mention [Rich-CLI](https://github.com/Textualize/rich-cli), [Trogon](https://github.com/Textualize/trogon), and [Frogmouth](https://github.com/Textualize/frogmouth)</code></pre><p>Today we are adding one project more to that lineup: <a href="https://github.com/Textualize/textual-web">textual-web</a>.</p>https://textual.textualize.io/blog/2023/09/06/what-is-textual-web/ Wed, 06 Sep 2023 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2023/09/06/what-is-textual-web/ Pull Requests are cake or puppies willmcgugan DevLog <h1>Pull Requests are cake or puppies</h1><p>Broadly speaking, there are two types of contributions you can make to an Open Source project.</p>https://textual.textualize.io/blog/2023/07/29/pull-requests-are-cake-or-puppies/ Sat, 29 Jul 2023 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2023/07/29/pull-requests-are-cake-or-puppies/ Using Rich Inspect to interrogate Python objects willmcgugan DevLog <h1>Using Rich Inspect to interrogate Python objects</h1><p>The <a href="https://github.com/Textualize/rich">Rich</a> library has a few functions that are admittedly a little out of scope for a terminal color library. One such function is <code>inspect</code> which is so useful you may want to <code>pip install rich</code> just for this feature.</p>https://textual.textualize.io/blog/2023/07/27/using-rich-inspect-to-interrogate-python-objects/ Thu, 27 Jul 2023 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2023/07/27/using-rich-inspect-to-interrogate-python-objects/ Textual 0.30.0 adds desktop-style notifications willmcgugan Release <h1>Textual 0.30.0 adds desktop-style notifications</h1><p>We have a new release of Textual to talk about, but before that I'd like to cover a little Textual news.</p>https://textual.textualize.io/blog/2023/07/17/textual-0300-adds-desktop-style-notifications/ Mon, 17 Jul 2023 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2023/07/17/textual-0300-adds-desktop-style-notifications/ Textual 0.29.0 refactors dev tools willmcgugan Release <h1>Textual 0.29.0 refactors dev tools</h1><p>It's been a slow week or two at Textualize, with Textual devs taking well-earned annual leave, but we still managed to get a new version out.</p>https://textual.textualize.io/blog/2023/07/03/textual-0290-refactors-dev-tools/ Mon, 03 Jul 2023 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2023/07/03/textual-0290-refactors-dev-tools/ To TUI or not to TUI willmcgugan DevLog <h1>To TUI or not to TUI</h1><p>Tech moves pretty fast.If you don’t stop and look around once in a while, you could miss it.And yet some technology feels like it has been around forever.</p><p>Terminals are one of those forever-technologies.</p>https://textual.textualize.io/blog/2023/06/06/to-tui-or-not-to-tui/ Tue, 06 Jun 2023 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2023/06/06/to-tui-or-not-to-tui/ Textual adds Sparklines, Selection list, Input validation, and tool tips willmcgugan Release <h1>Textual adds Sparklines, Selection list, Input validation, and tool tips</h1><p>It's been 12 days since the last Textual release, which is longer than our usual release cycle of a week.</p><p>We've been a little distracted with our "dogfood" projects: <a href="https://github.com/Textualize/frogmouth">Frogmouth</a> and <a href="https://github.com/Textualize/trogon">Trogon</a>. Both of which hit 1000 Github stars in 24 hours. We will be maintaining / updating those, but it is business as usual for this Textual release (and it's a big one). We have such sights to show you.</p>https://textual.textualize.io/blog/2023/06/01/textual-adds-sparklines-selection-list-input-validation-and-tool-tips/ Thu, 01 Jun 2023 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2023/06/01/textual-adds-sparklines-selection-list-input-validation-and-tool-tips/ Textual 0.24.0 adds a Select control willmcgugan Release <h1>Textual 0.24.0 adds a Select control</h1><p>Coming just 5 days after the last release, we have version 0.24.0 which we are crowning the King of Textual releases.At least until it is deposed by version 0.25.0.</p>https://textual.textualize.io/blog/2023/05/08/textual-0240-adds-a-select-control/ Mon, 08 May 2023 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2023/05/08/textual-0240-adds-a-select-control/ Textual 0.23.0 improves message handling willmcgugan Release <h1>Textual 0.23.0 improves message handling</h1><p>It's been a busy couple of weeks at Textualize.We've been building apps with <a href="https://github.com/Textualize/textual">Textual</a>, as part of our <em>dog-fooding</em> week.The first app, <a href="https://github.com/Textualize/frogmouth">Frogmouth</a>, was released at the weekend and already has 1K GitHub stars!Expect two more such apps this month.</p>https://textual.textualize.io/blog/2023/05/03/textual-0230-improves-message-handling/ Wed, 03 May 2023 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2023/05/03/textual-0230-improves-message-handling/ Textual 0.18.0 adds API for managing concurrent workers willmcgugan Release <h1>Textual 0.18.0 adds API for managing concurrent workers</h1><p>Less than a week since the last release, and we have a new API to show you.</p>https://textual.textualize.io/blog/2023/04/04/textual-0180-adds-api-for-managing-concurrent-workers/ Tue, 04 Apr 2023 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2023/04/04/textual-0180-adds-api-for-managing-concurrent-workers/ Textual 0.17.0 adds translucent screens and Option List willmcgugan Release <h1>Textual 0.17.0 adds translucent screens and Option List</h1><p>This is a surprisingly large release, given it has been just 7 days since the last version (and we were down a developer for most of that time).</p><p>What's new in this release?</p>https://textual.textualize.io/blog/2023/03/29/textual-0170-adds-translucent-screens-and-option-list/ Wed, 29 Mar 2023 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2023/03/29/textual-0170-adds-translucent-screens-and-option-list/ Textual 0.16.0 adds TabbedContent and border titles willmcgugan Release <h1>Textual 0.16.0 adds TabbedContent and border titles</h1><p>Textual 0.16.0 lands 9 days after the previous release. We have some new features to show you.</p>https://textual.textualize.io/blog/2023/03/22/textual-0160-adds-tabbedcontent-and-border-titles/ Wed, 22 Mar 2023 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2023/03/22/textual-0160-adds-tabbedcontent-and-border-titles/ No-async async with Python willmcgugan DevLog <h1>No-async async with Python</h1><p>A (reasonable) criticism of async is that it tends to proliferate in your code. In order to <code>await</code> something, your functions must be <code>async</code> all the way up the call-stack. This tends to result in you making things <code>async</code> just to support that one call that needs it or, worse, adding <code>async</code> just-in-case. Given that going from <code>def</code> to <code>async def</code> is a breaking change there is a strong incentive to go straight there.</p><p>Before you know it, you have adopted a policy of "async all the things".</p>https://textual.textualize.io/blog/2023/03/15/no-async-async-with-python/ Wed, 15 Mar 2023 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2023/03/15/no-async-async-with-python/ \ No newline at end of file + Textualhttps://textual.textualize.io/https://github.com/textualize/textual/en Sat, 11 May 2024 11:09:05 -0000 Sat, 11 May 2024 11:09:05 -0000 1440 MkDocs RSS plugin - v1.12.1 Behind the Curtain of Inline Terminal Applications willmcgugan DevLog <h1>Behind the Curtain of Inline Terminal Applications</h1><p>Textual recently added the ability to run <em>inline</em> terminal apps.You can see this in action if you run the <a href="https://github.com/Textualize/textual/blob/main/examples/calculator.py">calculator example</a>:</p><p><img alt="Inline Calculator" src="../images/calcinline.png"></p><p>The application appears directly under the prompt, rather than occupying the full height of the screen&mdash;which is more typical of TUI applications.You can interact with this calculator using keys <em>or</em> the mouse.When you press ++ctrl+c++ the calculator disappears and returns you to the prompt.</p><p>Here's another app that creates an inline code editor:</p><p>=== "Video"</p><pre><code>&lt;div class="video-wrapper"&gt; &lt;iframe width="852" height="525" src="https://www.youtube.com/embed/Dt70oSID1DY" title="Inline app" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen&gt;&lt;/iframe&gt;&lt;/div&gt;</code></pre><p>=== "inline.py" ```python from textual.app import App, ComposeResult from textual.widgets import TextArea</p><pre><code>class InlineApp(App): CSS = """ TextArea { height: auto; max-height: 50vh; } """ def compose(self) -&gt; ComposeResult: yield TextArea(language="python")if __name__ == "__main__": InlineApp().run(inline=True)```</code></pre><p>This post will cover some of what goes on under the hood to make such inline apps work.</p><p>It's not going to go in to too much detail.I'm assuming most readers will be more interested in a birds-eye view rather than all the gory details.</p>https://textual.textualize.io/blog/2024/04/20/behind-the-curtain-of-inline-terminal-applications/ Sat, 20 Apr 2024 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2024/04/20/behind-the-curtain-of-inline-terminal-applications/ Remote memory profiling with Memray willmcgugan DevLog <h1>Remote memory profiling with Memray</h1><p><a href="https://github.com/bloomberg/memray">Memray</a> is a memory profiler for Python, built by some very smart devs at Bloomberg.It is a fantastic tool to identify memory leaks in your code or other libraries (down to the C level)!</p><p>They recently added a <a href="https://github.com/textualize/textual/">Textual</a> interface which looks amazing, and lets you monitor your process right from the terminal:</p><p><img alt="Memray" src="https://raw.githubusercontent.com/bloomberg/memray/main/docs/_static/images/live_animated.webp"></p>https://textual.textualize.io/blog/2024/02/20/remote-memory-profiling-with-memray/ Tue, 20 Feb 2024 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2024/02/20/remote-memory-profiling-with-memray/ File magic with the Python standard library willmcgugan DevLog <h1>File magic with the Python standard library</h1><p>I recently published <a href="https://github.com/textualize/toolong">Toolong</a>, an app for viewing log files.There were some interesting technical challenges in building Toolong that I'd like to cover in this post.</p>https://textual.textualize.io/blog/2024/02/11/file-magic-with-the-python-standard-library/ Sun, 11 Feb 2024 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2024/02/11/file-magic-with-the-python-standard-library/ Announcing textual-plotext davep DevLog <h1>Announcing textual-plotext</h1><p>It's no surprise that a common question on the <a href="https://discord.gg/Enf6Z3qhVr">Textual Discordserver</a> is how to go about producing plots inthe terminal. A popular solution that has been suggested is<a href="https://github.com/piccolomo/plotext">Plotext</a>. While Plotext doesn'tdirectly support Textual, it is <a href="https://github.com/piccolomo/plotext/blob/master/readme/environments.md#rich">easy to use withRich</a>and, because of this, we wanted to make it just as easy to use in yourTextual applications.</p>https://textual.textualize.io/blog/2023/10/04/announcing-textual-plotext/ Wed, 04 Oct 2023 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2023/10/04/announcing-textual-plotext/ Textual 0.38.0 adds a syntax aware TextArea willmcgugan Release <h1>Textual 0.38.0 adds a syntax aware TextArea</h1><p>This is the second big feature release this month after last week's <a href="./release0.37.0.md">command palette</a>.</p>https://textual.textualize.io/blog/2023/09/21/textual-0380-adds-a-syntax-aware-textarea/ Thu, 21 Sep 2023 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2023/09/21/textual-0380-adds-a-syntax-aware-textarea/ Things I learned while building Textual's TextArea darrenburns DevLog <h1>Things I learned building a text editor for the terminal</h1><p><code>TextArea</code> is the latest widget to be added to Textual's <a href="https://textual.textualize.io/widget_gallery/">growing collection</a>.It provides a multi-line space to edit text, and features optional syntax highlighting for a selection of languages.</p><p><img alt="text-area-welcome.gif" src="../images/text-area-learnings/text-area-welcome.gif"></p><p>Adding a <code>TextArea</code> to your Textual app is as simple as adding this to your <code>compose</code> method:</p><p><code>pythonyield TextArea()</code></p><p>Enabling syntax highlighting for a language is as simple as:</p><p><code>pythonyield TextArea(language="python")</code></p><p>Working on the <code>TextArea</code> widget for Textual taught me a lot about Python and my generalapproach to software engineering. It gave me an appreciation for the subtle functionality behindthe editors we use on a daily basis — features we may not even notice, despitesome engineer spending hours perfecting it to provide a small boost to our development experience.</p><p>This post is a tour of some of these learnings.</p>https://textual.textualize.io/blog/2023/09/18/things-i-learned-while-building-textuals-textarea/ Mon, 18 Sep 2023 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2023/09/18/things-i-learned-while-building-textuals-textarea/ Textual 0.37.0 adds a command palette willmcgugan Release <h1>Textual 0.37.0 adds a command palette</h1><p>Textual version 0.37.0 has landed!The highlight of this release is the new command palette.</p>https://textual.textualize.io/blog/2023/09/15/textual-0370-adds-a-command-palette/ Fri, 15 Sep 2023 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2023/09/15/textual-0370-adds-a-command-palette/ What is Textual Web? willmcgugan News <h1>What is Textual Web?</h1><p>If you know us, you will know that we are the team behind <a href="https://github.com/Textualize/rich">Rich</a> and <a href="https://github.com/Textualize/textual">Textual</a> &mdash; two popular Python libraries that work magic in the terminal.</p><p>!!! note</p><pre><code>Not to mention [Rich-CLI](https://github.com/Textualize/rich-cli), [Trogon](https://github.com/Textualize/trogon), and [Frogmouth](https://github.com/Textualize/frogmouth)</code></pre><p>Today we are adding one project more to that lineup: <a href="https://github.com/Textualize/textual-web">textual-web</a>.</p>https://textual.textualize.io/blog/2023/09/06/what-is-textual-web/ Wed, 06 Sep 2023 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2023/09/06/what-is-textual-web/ Pull Requests are cake or puppies willmcgugan DevLog <h1>Pull Requests are cake or puppies</h1><p>Broadly speaking, there are two types of contributions you can make to an Open Source project.</p>https://textual.textualize.io/blog/2023/07/29/pull-requests-are-cake-or-puppies/ Sat, 29 Jul 2023 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2023/07/29/pull-requests-are-cake-or-puppies/ Using Rich Inspect to interrogate Python objects willmcgugan DevLog <h1>Using Rich Inspect to interrogate Python objects</h1><p>The <a href="https://github.com/Textualize/rich">Rich</a> library has a few functions that are admittedly a little out of scope for a terminal color library. One such function is <code>inspect</code> which is so useful you may want to <code>pip install rich</code> just for this feature.</p>https://textual.textualize.io/blog/2023/07/27/using-rich-inspect-to-interrogate-python-objects/ Thu, 27 Jul 2023 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2023/07/27/using-rich-inspect-to-interrogate-python-objects/ Textual 0.30.0 adds desktop-style notifications willmcgugan Release <h1>Textual 0.30.0 adds desktop-style notifications</h1><p>We have a new release of Textual to talk about, but before that I'd like to cover a little Textual news.</p>https://textual.textualize.io/blog/2023/07/17/textual-0300-adds-desktop-style-notifications/ Mon, 17 Jul 2023 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2023/07/17/textual-0300-adds-desktop-style-notifications/ Textual 0.29.0 refactors dev tools willmcgugan Release <h1>Textual 0.29.0 refactors dev tools</h1><p>It's been a slow week or two at Textualize, with Textual devs taking well-earned annual leave, but we still managed to get a new version out.</p>https://textual.textualize.io/blog/2023/07/03/textual-0290-refactors-dev-tools/ Mon, 03 Jul 2023 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2023/07/03/textual-0290-refactors-dev-tools/ To TUI or not to TUI willmcgugan DevLog <h1>To TUI or not to TUI</h1><p>Tech moves pretty fast.If you don’t stop and look around once in a while, you could miss it.And yet some technology feels like it has been around forever.</p><p>Terminals are one of those forever-technologies.</p>https://textual.textualize.io/blog/2023/06/06/to-tui-or-not-to-tui/ Tue, 06 Jun 2023 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2023/06/06/to-tui-or-not-to-tui/ Textual adds Sparklines, Selection list, Input validation, and tool tips willmcgugan Release <h1>Textual adds Sparklines, Selection list, Input validation, and tool tips</h1><p>It's been 12 days since the last Textual release, which is longer than our usual release cycle of a week.</p><p>We've been a little distracted with our "dogfood" projects: <a href="https://github.com/Textualize/frogmouth">Frogmouth</a> and <a href="https://github.com/Textualize/trogon">Trogon</a>. Both of which hit 1000 Github stars in 24 hours. We will be maintaining / updating those, but it is business as usual for this Textual release (and it's a big one). We have such sights to show you.</p>https://textual.textualize.io/blog/2023/06/01/textual-adds-sparklines-selection-list-input-validation-and-tool-tips/ Thu, 01 Jun 2023 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2023/06/01/textual-adds-sparklines-selection-list-input-validation-and-tool-tips/ Textual 0.24.0 adds a Select control willmcgugan Release <h1>Textual 0.24.0 adds a Select control</h1><p>Coming just 5 days after the last release, we have version 0.24.0 which we are crowning the King of Textual releases.At least until it is deposed by version 0.25.0.</p>https://textual.textualize.io/blog/2023/05/08/textual-0240-adds-a-select-control/ Mon, 08 May 2023 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2023/05/08/textual-0240-adds-a-select-control/ Textual 0.23.0 improves message handling willmcgugan Release <h1>Textual 0.23.0 improves message handling</h1><p>It's been a busy couple of weeks at Textualize.We've been building apps with <a href="https://github.com/Textualize/textual">Textual</a>, as part of our <em>dog-fooding</em> week.The first app, <a href="https://github.com/Textualize/frogmouth">Frogmouth</a>, was released at the weekend and already has 1K GitHub stars!Expect two more such apps this month.</p>https://textual.textualize.io/blog/2023/05/03/textual-0230-improves-message-handling/ Wed, 03 May 2023 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2023/05/03/textual-0230-improves-message-handling/ Textual 0.18.0 adds API for managing concurrent workers willmcgugan Release <h1>Textual 0.18.0 adds API for managing concurrent workers</h1><p>Less than a week since the last release, and we have a new API to show you.</p>https://textual.textualize.io/blog/2023/04/04/textual-0180-adds-api-for-managing-concurrent-workers/ Tue, 04 Apr 2023 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2023/04/04/textual-0180-adds-api-for-managing-concurrent-workers/ Textual 0.17.0 adds translucent screens and Option List willmcgugan Release <h1>Textual 0.17.0 adds translucent screens and Option List</h1><p>This is a surprisingly large release, given it has been just 7 days since the last version (and we were down a developer for most of that time).</p><p>What's new in this release?</p>https://textual.textualize.io/blog/2023/03/29/textual-0170-adds-translucent-screens-and-option-list/ Wed, 29 Mar 2023 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2023/03/29/textual-0170-adds-translucent-screens-and-option-list/ Textual 0.16.0 adds TabbedContent and border titles willmcgugan Release <h1>Textual 0.16.0 adds TabbedContent and border titles</h1><p>Textual 0.16.0 lands 9 days after the previous release. We have some new features to show you.</p>https://textual.textualize.io/blog/2023/03/22/textual-0160-adds-tabbedcontent-and-border-titles/ Wed, 22 Mar 2023 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2023/03/22/textual-0160-adds-tabbedcontent-and-border-titles/ No-async async with Python willmcgugan DevLog <h1>No-async async with Python</h1><p>A (reasonable) criticism of async is that it tends to proliferate in your code. In order to <code>await</code> something, your functions must be <code>async</code> all the way up the call-stack. This tends to result in you making things <code>async</code> just to support that one call that needs it or, worse, adding <code>async</code> just-in-case. Given that going from <code>def</code> to <code>async def</code> is a breaking change there is a strong incentive to go straight there.</p><p>Before you know it, you have adopted a policy of "async all the things".</p>https://textual.textualize.io/blog/2023/03/15/no-async-async-with-python/ Wed, 15 Mar 2023 00:00:00 +0000Textualhttps://textual.textualize.io/blog/2023/03/15/no-async-async-with-python/ \ No newline at end of file diff --git a/feed_rss_updated.xml b/feed_rss_updated.xml index c4ececdb3d..6245c2dbd9 100644 --- a/feed_rss_updated.xml +++ b/feed_rss_updated.xml @@ -1 +1 @@ - Textualhttps://textual.textualize.io/https://github.com/textualize/textual/en Sun, 21 Apr 2024 12:21:59 -0000 Sun, 21 Apr 2024 12:21:59 -0000 1440 MkDocs RSS plugin - v1.12.1 Behind the Curtain of Inline Terminal Applications willmcgugan DevLog <h1>Behind the Curtain of Inline Terminal Applications</h1><p>Textual recently added the ability to run <em>inline</em> terminal apps.You can see this in action if you run the <a href="https://github.com/Textualize/textual/blob/main/examples/calculator.py">calculator example</a>:</p><p><img alt="Inline Calculator" src="../images/calcinline.png"></p><p>The application appears directly under the prompt, rather than occupying the full height of the screen&mdash;which is more typical of TUI applications.You can interact with this calculator using keys <em>or</em> the mouse.When you press ++ctrl+c++ the calculator disappears and returns you to the prompt.</p><p>Here's another app that creates an inline code editor:</p><p>=== "Video"</p><pre><code>&lt;div class="video-wrapper"&gt; &lt;iframe width="852" height="525" src="https://www.youtube.com/embed/Dt70oSID1DY" title="Inline app" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen&gt;&lt;/iframe&gt;&lt;/div&gt;</code></pre><p>=== "inline.py" ```python from textual.app import App, ComposeResult from textual.widgets import TextArea</p><pre><code>class InlineApp(App): CSS = """ TextArea { height: auto; max-height: 50vh; } """ def compose(self) -&gt; ComposeResult: yield TextArea(language="python")if __name__ == "__main__": InlineApp().run(inline=True)```</code></pre><p>This post will cover some of what goes on under the hood to make such inline apps work.</p><p>It's not going to go in to too much detail.I'm assuming most readers will be more interested in a birds-eye view rather than all the gory details.</p>https://textual.textualize.io/blog/2024/04/20/behind-the-curtain-of-inline-terminal-applications/ Sun, 21 Apr 2024 13:21:53 +0000Textualhttps://textual.textualize.io/blog/2024/04/20/behind-the-curtain-of-inline-terminal-applications/ File magic with the Python standard library willmcgugan DevLog <h1>File magic with the Python standard library</h1><p>I recently published <a href="https://github.com/textualize/toolong">Toolong</a>, an app for viewing log files.There were some interesting technical challenges in building Toolong that I'd like to cover in this post.</p>https://textual.textualize.io/blog/2024/02/11/file-magic-with-the-python-standard-library/ Sun, 03 Mar 2024 13:32:04 +0000Textualhttps://textual.textualize.io/blog/2024/02/11/file-magic-with-the-python-standard-library/ Remote memory profiling with Memray willmcgugan DevLog <h1>Remote memory profiling with Memray</h1><p><a href="https://github.com/bloomberg/memray">Memray</a> is a memory profiler for Python, built by some very smart devs at Bloomberg.It is a fantastic tool to identify memory leaks in your code or other libraries (down to the C level)!</p><p>They recently added a <a href="https://github.com/textualize/textual/">Textual</a> interface which looks amazing, and lets you monitor your process right from the terminal:</p><p><img alt="Memray" src="https://raw.githubusercontent.com/bloomberg/memray/main/docs/_static/images/live_animated.webp"></p>https://textual.textualize.io/blog/2024/02/20/remote-memory-profiling-with-memray/ Tue, 20 Feb 2024 15:54:07 +0000Textualhttps://textual.textualize.io/blog/2024/02/20/remote-memory-profiling-with-memray/ Announcing textual-plotext davep DevLog <h1>Announcing textual-plotext</h1><p>It's no surprise that a common question on the <a href="https://discord.gg/Enf6Z3qhVr">Textual Discordserver</a> is how to go about producing plots inthe terminal. A popular solution that has been suggested is<a href="https://github.com/piccolomo/plotext">Plotext</a>. While Plotext doesn'tdirectly support Textual, it is <a href="https://github.com/piccolomo/plotext/blob/master/readme/environments.md#rich">easy to use withRich</a>and, because of this, we wanted to make it just as easy to use in yourTextual applications.</p>https://textual.textualize.io/blog/2023/10/04/announcing-textual-plotext/ Sat, 07 Oct 2023 13:42:11 +0000Textualhttps://textual.textualize.io/blog/2023/10/04/announcing-textual-plotext/ Things I learned while building Textual's TextArea darrenburns DevLog <h1>Things I learned building a text editor for the terminal</h1><p><code>TextArea</code> is the latest widget to be added to Textual's <a href="https://textual.textualize.io/widget_gallery/">growing collection</a>.It provides a multi-line space to edit text, and features optional syntax highlighting for a selection of languages.</p><p><img alt="text-area-welcome.gif" src="../images/text-area-learnings/text-area-welcome.gif"></p><p>Adding a <code>TextArea</code> to your Textual app is as simple as adding this to your <code>compose</code> method:</p><p><code>pythonyield TextArea()</code></p><p>Enabling syntax highlighting for a language is as simple as:</p><p><code>pythonyield TextArea(language="python")</code></p><p>Working on the <code>TextArea</code> widget for Textual taught me a lot about Python and my generalapproach to software engineering. It gave me an appreciation for the subtle functionality behindthe editors we use on a daily basis — features we may not even notice, despitesome engineer spending hours perfecting it to provide a small boost to our development experience.</p><p>This post is a tour of some of these learnings.</p>https://textual.textualize.io/blog/2023/09/18/things-i-learned-while-building-textuals-textarea/ Sat, 23 Sep 2023 14:06:20 +0000Textualhttps://textual.textualize.io/blog/2023/09/18/things-i-learned-while-building-textuals-textarea/ Textual 0.38.0 adds a syntax aware TextArea willmcgugan Release <h1>Textual 0.38.0 adds a syntax aware TextArea</h1><p>This is the second big feature release this month after last week's <a href="./release0.37.0.md">command palette</a>.</p>https://textual.textualize.io/blog/2023/09/21/textual-0380-adds-a-syntax-aware-textarea/ Thu, 21 Sep 2023 13:27:43 +0000Textualhttps://textual.textualize.io/blog/2023/09/21/textual-0380-adds-a-syntax-aware-textarea/ Textual 0.37.0 adds a command palette willmcgugan Release <h1>Textual 0.37.0 adds a command palette</h1><p>Textual version 0.37.0 has landed!The highlight of this release is the new command palette.</p>https://textual.textualize.io/blog/2023/09/15/textual-0370-adds-a-command-palette/ Fri, 15 Sep 2023 17:01:09 +0000Textualhttps://textual.textualize.io/blog/2023/09/15/textual-0370-adds-a-command-palette/ What is Textual Web? willmcgugan News <h1>What is Textual Web?</h1><p>If you know us, you will know that we are the team behind <a href="https://github.com/Textualize/rich">Rich</a> and <a href="https://github.com/Textualize/textual">Textual</a> &mdash; two popular Python libraries that work magic in the terminal.</p><p>!!! note</p><pre><code>Not to mention [Rich-CLI](https://github.com/Textualize/rich-cli), [Trogon](https://github.com/Textualize/trogon), and [Frogmouth](https://github.com/Textualize/frogmouth)</code></pre><p>Today we are adding one project more to that lineup: <a href="https://github.com/Textualize/textual-web">textual-web</a>.</p>https://textual.textualize.io/blog/2023/09/06/what-is-textual-web/ Wed, 06 Sep 2023 17:53:31 +0000Textualhttps://textual.textualize.io/blog/2023/09/06/what-is-textual-web/ Pull Requests are cake or puppies willmcgugan DevLog <h1>Pull Requests are cake or puppies</h1><p>Broadly speaking, there are two types of contributions you can make to an Open Source project.</p>https://textual.textualize.io/blog/2023/07/29/pull-requests-are-cake-or-puppies/ Sat, 29 Jul 2023 17:05:04 +0000Textualhttps://textual.textualize.io/blog/2023/07/29/pull-requests-are-cake-or-puppies/ Using Rich Inspect to interrogate Python objects willmcgugan DevLog <h1>Using Rich Inspect to interrogate Python objects</h1><p>The <a href="https://github.com/Textualize/rich">Rich</a> library has a few functions that are admittedly a little out of scope for a terminal color library. One such function is <code>inspect</code> which is so useful you may want to <code>pip install rich</code> just for this feature.</p>https://textual.textualize.io/blog/2023/07/27/using-rich-inspect-to-interrogate-python-objects/ Thu, 27 Jul 2023 12:34:46 +0000Textualhttps://textual.textualize.io/blog/2023/07/27/using-rich-inspect-to-interrogate-python-objects/ Textual 0.30.0 adds desktop-style notifications willmcgugan Release <h1>Textual 0.30.0 adds desktop-style notifications</h1><p>We have a new release of Textual to talk about, but before that I'd like to cover a little Textual news.</p>https://textual.textualize.io/blog/2023/07/17/textual-0300-adds-desktop-style-notifications/ Mon, 17 Jul 2023 14:08:32 +0000Textualhttps://textual.textualize.io/blog/2023/07/17/textual-0300-adds-desktop-style-notifications/ Textual 0.29.0 refactors dev tools willmcgugan Release <h1>Textual 0.29.0 refactors dev tools</h1><p>It's been a slow week or two at Textualize, with Textual devs taking well-earned annual leave, but we still managed to get a new version out.</p>https://textual.textualize.io/blog/2023/07/03/textual-0290-refactors-dev-tools/ Mon, 03 Jul 2023 16:09:24 +0000Textualhttps://textual.textualize.io/blog/2023/07/03/textual-0290-refactors-dev-tools/ To TUI or not to TUI willmcgugan DevLog <h1>To TUI or not to TUI</h1><p>Tech moves pretty fast.If you don’t stop and look around once in a while, you could miss it.And yet some technology feels like it has been around forever.</p><p>Terminals are one of those forever-technologies.</p>https://textual.textualize.io/blog/2023/06/06/to-tui-or-not-to-tui/ Mon, 05 Jun 2023 17:51:19 +0000Textualhttps://textual.textualize.io/blog/2023/06/06/to-tui-or-not-to-tui/ Textual adds Sparklines, Selection list, Input validation, and tool tips willmcgugan Release <h1>Textual adds Sparklines, Selection list, Input validation, and tool tips</h1><p>It's been 12 days since the last Textual release, which is longer than our usual release cycle of a week.</p><p>We've been a little distracted with our "dogfood" projects: <a href="https://github.com/Textualize/frogmouth">Frogmouth</a> and <a href="https://github.com/Textualize/trogon">Trogon</a>. Both of which hit 1000 Github stars in 24 hours. We will be maintaining / updating those, but it is business as usual for this Textual release (and it's a big one). We have such sights to show you.</p>https://textual.textualize.io/blog/2023/06/01/textual-adds-sparklines-selection-list-input-validation-and-tool-tips/ Thu, 01 Jun 2023 17:41:08 +0000Textualhttps://textual.textualize.io/blog/2023/06/01/textual-adds-sparklines-selection-list-input-validation-and-tool-tips/ Textual 0.24.0 adds a Select control willmcgugan Release <h1>Textual 0.24.0 adds a Select control</h1><p>Coming just 5 days after the last release, we have version 0.24.0 which we are crowning the King of Textual releases.At least until it is deposed by version 0.25.0.</p>https://textual.textualize.io/blog/2023/05/08/textual-0240-adds-a-select-control/ Thu, 01 Jun 2023 11:33:54 +0000Textualhttps://textual.textualize.io/blog/2023/05/08/textual-0240-adds-a-select-control/ Textual 0.23.0 improves message handling willmcgugan Release <h1>Textual 0.23.0 improves message handling</h1><p>It's been a busy couple of weeks at Textualize.We've been building apps with <a href="https://github.com/Textualize/textual">Textual</a>, as part of our <em>dog-fooding</em> week.The first app, <a href="https://github.com/Textualize/frogmouth">Frogmouth</a>, was released at the weekend and already has 1K GitHub stars!Expect two more such apps this month.</p>https://textual.textualize.io/blog/2023/05/03/textual-0230-improves-message-handling/ Wed, 03 May 2023 13:22:22 +0000Textualhttps://textual.textualize.io/blog/2023/05/03/textual-0230-improves-message-handling/ Textual 0.11.0 adds a beautiful Markdown widget willmcgugan Release <h1>Textual 0.11.0 adds a beautiful Markdown widget</h1><p>We released Textual 0.10.0 25 days ago, which is a little longer than our usual release cycle. What have we been up to?</p>https://textual.textualize.io/blog/2023/02/15/textual-0110-adds-a-beautiful-markdown-widget/ Sat, 08 Apr 2023 15:35:49 +0000Textualhttps://textual.textualize.io/blog/2023/02/15/textual-0110-adds-a-beautiful-markdown-widget/ Textual 0.18.0 adds API for managing concurrent workers willmcgugan Release <h1>Textual 0.18.0 adds API for managing concurrent workers</h1><p>Less than a week since the last release, and we have a new API to show you.</p>https://textual.textualize.io/blog/2023/04/04/textual-0180-adds-api-for-managing-concurrent-workers/ Tue, 04 Apr 2023 13:12:51 +0000Textualhttps://textual.textualize.io/blog/2023/04/04/textual-0180-adds-api-for-managing-concurrent-workers/ Textual 0.17.0 adds translucent screens and Option List willmcgugan Release <h1>Textual 0.17.0 adds translucent screens and Option List</h1><p>This is a surprisingly large release, given it has been just 7 days since the last version (and we were down a developer for most of that time).</p><p>What's new in this release?</p>https://textual.textualize.io/blog/2023/03/29/textual-0170-adds-translucent-screens-and-option-list/ Wed, 29 Mar 2023 16:29:28 +0000Textualhttps://textual.textualize.io/blog/2023/03/29/textual-0170-adds-translucent-screens-and-option-list/ Textual 0.16.0 adds TabbedContent and border titles willmcgugan Release <h1>Textual 0.16.0 adds TabbedContent and border titles</h1><p>Textual 0.16.0 lands 9 days after the previous release. We have some new features to show you.</p>https://textual.textualize.io/blog/2023/03/22/textual-0160-adds-tabbedcontent-and-border-titles/ Wed, 22 Mar 2023 13:52:31 +0000Textualhttps://textual.textualize.io/blog/2023/03/22/textual-0160-adds-tabbedcontent-and-border-titles/ \ No newline at end of file + Textualhttps://textual.textualize.io/https://github.com/textualize/textual/en Sat, 11 May 2024 11:09:05 -0000 Sat, 11 May 2024 11:09:05 -0000 1440 MkDocs RSS plugin - v1.12.1 Behind the Curtain of Inline Terminal Applications willmcgugan DevLog <h1>Behind the Curtain of Inline Terminal Applications</h1><p>Textual recently added the ability to run <em>inline</em> terminal apps.You can see this in action if you run the <a href="https://github.com/Textualize/textual/blob/main/examples/calculator.py">calculator example</a>:</p><p><img alt="Inline Calculator" src="../images/calcinline.png"></p><p>The application appears directly under the prompt, rather than occupying the full height of the screen&mdash;which is more typical of TUI applications.You can interact with this calculator using keys <em>or</em> the mouse.When you press ++ctrl+c++ the calculator disappears and returns you to the prompt.</p><p>Here's another app that creates an inline code editor:</p><p>=== "Video"</p><pre><code>&lt;div class="video-wrapper"&gt; &lt;iframe width="852" height="525" src="https://www.youtube.com/embed/Dt70oSID1DY" title="Inline app" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen&gt;&lt;/iframe&gt;&lt;/div&gt;</code></pre><p>=== "inline.py" ```python from textual.app import App, ComposeResult from textual.widgets import TextArea</p><pre><code>class InlineApp(App): CSS = """ TextArea { height: auto; max-height: 50vh; } """ def compose(self) -&gt; ComposeResult: yield TextArea(language="python")if __name__ == "__main__": InlineApp().run(inline=True)```</code></pre><p>This post will cover some of what goes on under the hood to make such inline apps work.</p><p>It's not going to go in to too much detail.I'm assuming most readers will be more interested in a birds-eye view rather than all the gory details.</p>https://textual.textualize.io/blog/2024/04/20/behind-the-curtain-of-inline-terminal-applications/ Sun, 21 Apr 2024 13:21:53 +0000Textualhttps://textual.textualize.io/blog/2024/04/20/behind-the-curtain-of-inline-terminal-applications/ File magic with the Python standard library willmcgugan DevLog <h1>File magic with the Python standard library</h1><p>I recently published <a href="https://github.com/textualize/toolong">Toolong</a>, an app for viewing log files.There were some interesting technical challenges in building Toolong that I'd like to cover in this post.</p>https://textual.textualize.io/blog/2024/02/11/file-magic-with-the-python-standard-library/ Sun, 03 Mar 2024 13:32:04 +0000Textualhttps://textual.textualize.io/blog/2024/02/11/file-magic-with-the-python-standard-library/ Remote memory profiling with Memray willmcgugan DevLog <h1>Remote memory profiling with Memray</h1><p><a href="https://github.com/bloomberg/memray">Memray</a> is a memory profiler for Python, built by some very smart devs at Bloomberg.It is a fantastic tool to identify memory leaks in your code or other libraries (down to the C level)!</p><p>They recently added a <a href="https://github.com/textualize/textual/">Textual</a> interface which looks amazing, and lets you monitor your process right from the terminal:</p><p><img alt="Memray" src="https://raw.githubusercontent.com/bloomberg/memray/main/docs/_static/images/live_animated.webp"></p>https://textual.textualize.io/blog/2024/02/20/remote-memory-profiling-with-memray/ Tue, 20 Feb 2024 15:54:07 +0000Textualhttps://textual.textualize.io/blog/2024/02/20/remote-memory-profiling-with-memray/ Announcing textual-plotext davep DevLog <h1>Announcing textual-plotext</h1><p>It's no surprise that a common question on the <a href="https://discord.gg/Enf6Z3qhVr">Textual Discordserver</a> is how to go about producing plots inthe terminal. A popular solution that has been suggested is<a href="https://github.com/piccolomo/plotext">Plotext</a>. While Plotext doesn'tdirectly support Textual, it is <a href="https://github.com/piccolomo/plotext/blob/master/readme/environments.md#rich">easy to use withRich</a>and, because of this, we wanted to make it just as easy to use in yourTextual applications.</p>https://textual.textualize.io/blog/2023/10/04/announcing-textual-plotext/ Sat, 07 Oct 2023 13:42:11 +0000Textualhttps://textual.textualize.io/blog/2023/10/04/announcing-textual-plotext/ Things I learned while building Textual's TextArea darrenburns DevLog <h1>Things I learned building a text editor for the terminal</h1><p><code>TextArea</code> is the latest widget to be added to Textual's <a href="https://textual.textualize.io/widget_gallery/">growing collection</a>.It provides a multi-line space to edit text, and features optional syntax highlighting for a selection of languages.</p><p><img alt="text-area-welcome.gif" src="../images/text-area-learnings/text-area-welcome.gif"></p><p>Adding a <code>TextArea</code> to your Textual app is as simple as adding this to your <code>compose</code> method:</p><p><code>pythonyield TextArea()</code></p><p>Enabling syntax highlighting for a language is as simple as:</p><p><code>pythonyield TextArea(language="python")</code></p><p>Working on the <code>TextArea</code> widget for Textual taught me a lot about Python and my generalapproach to software engineering. It gave me an appreciation for the subtle functionality behindthe editors we use on a daily basis — features we may not even notice, despitesome engineer spending hours perfecting it to provide a small boost to our development experience.</p><p>This post is a tour of some of these learnings.</p>https://textual.textualize.io/blog/2023/09/18/things-i-learned-while-building-textuals-textarea/ Sat, 23 Sep 2023 14:06:20 +0000Textualhttps://textual.textualize.io/blog/2023/09/18/things-i-learned-while-building-textuals-textarea/ Textual 0.38.0 adds a syntax aware TextArea willmcgugan Release <h1>Textual 0.38.0 adds a syntax aware TextArea</h1><p>This is the second big feature release this month after last week's <a href="./release0.37.0.md">command palette</a>.</p>https://textual.textualize.io/blog/2023/09/21/textual-0380-adds-a-syntax-aware-textarea/ Thu, 21 Sep 2023 13:27:43 +0000Textualhttps://textual.textualize.io/blog/2023/09/21/textual-0380-adds-a-syntax-aware-textarea/ Textual 0.37.0 adds a command palette willmcgugan Release <h1>Textual 0.37.0 adds a command palette</h1><p>Textual version 0.37.0 has landed!The highlight of this release is the new command palette.</p>https://textual.textualize.io/blog/2023/09/15/textual-0370-adds-a-command-palette/ Fri, 15 Sep 2023 17:01:09 +0000Textualhttps://textual.textualize.io/blog/2023/09/15/textual-0370-adds-a-command-palette/ What is Textual Web? willmcgugan News <h1>What is Textual Web?</h1><p>If you know us, you will know that we are the team behind <a href="https://github.com/Textualize/rich">Rich</a> and <a href="https://github.com/Textualize/textual">Textual</a> &mdash; two popular Python libraries that work magic in the terminal.</p><p>!!! note</p><pre><code>Not to mention [Rich-CLI](https://github.com/Textualize/rich-cli), [Trogon](https://github.com/Textualize/trogon), and [Frogmouth](https://github.com/Textualize/frogmouth)</code></pre><p>Today we are adding one project more to that lineup: <a href="https://github.com/Textualize/textual-web">textual-web</a>.</p>https://textual.textualize.io/blog/2023/09/06/what-is-textual-web/ Wed, 06 Sep 2023 17:53:31 +0000Textualhttps://textual.textualize.io/blog/2023/09/06/what-is-textual-web/ Pull Requests are cake or puppies willmcgugan DevLog <h1>Pull Requests are cake or puppies</h1><p>Broadly speaking, there are two types of contributions you can make to an Open Source project.</p>https://textual.textualize.io/blog/2023/07/29/pull-requests-are-cake-or-puppies/ Sat, 29 Jul 2023 17:05:04 +0000Textualhttps://textual.textualize.io/blog/2023/07/29/pull-requests-are-cake-or-puppies/ Using Rich Inspect to interrogate Python objects willmcgugan DevLog <h1>Using Rich Inspect to interrogate Python objects</h1><p>The <a href="https://github.com/Textualize/rich">Rich</a> library has a few functions that are admittedly a little out of scope for a terminal color library. One such function is <code>inspect</code> which is so useful you may want to <code>pip install rich</code> just for this feature.</p>https://textual.textualize.io/blog/2023/07/27/using-rich-inspect-to-interrogate-python-objects/ Thu, 27 Jul 2023 12:34:46 +0000Textualhttps://textual.textualize.io/blog/2023/07/27/using-rich-inspect-to-interrogate-python-objects/ Textual 0.30.0 adds desktop-style notifications willmcgugan Release <h1>Textual 0.30.0 adds desktop-style notifications</h1><p>We have a new release of Textual to talk about, but before that I'd like to cover a little Textual news.</p>https://textual.textualize.io/blog/2023/07/17/textual-0300-adds-desktop-style-notifications/ Mon, 17 Jul 2023 14:08:32 +0000Textualhttps://textual.textualize.io/blog/2023/07/17/textual-0300-adds-desktop-style-notifications/ Textual 0.29.0 refactors dev tools willmcgugan Release <h1>Textual 0.29.0 refactors dev tools</h1><p>It's been a slow week or two at Textualize, with Textual devs taking well-earned annual leave, but we still managed to get a new version out.</p>https://textual.textualize.io/blog/2023/07/03/textual-0290-refactors-dev-tools/ Mon, 03 Jul 2023 16:09:24 +0000Textualhttps://textual.textualize.io/blog/2023/07/03/textual-0290-refactors-dev-tools/ To TUI or not to TUI willmcgugan DevLog <h1>To TUI or not to TUI</h1><p>Tech moves pretty fast.If you don’t stop and look around once in a while, you could miss it.And yet some technology feels like it has been around forever.</p><p>Terminals are one of those forever-technologies.</p>https://textual.textualize.io/blog/2023/06/06/to-tui-or-not-to-tui/ Mon, 05 Jun 2023 17:51:19 +0000Textualhttps://textual.textualize.io/blog/2023/06/06/to-tui-or-not-to-tui/ Textual adds Sparklines, Selection list, Input validation, and tool tips willmcgugan Release <h1>Textual adds Sparklines, Selection list, Input validation, and tool tips</h1><p>It's been 12 days since the last Textual release, which is longer than our usual release cycle of a week.</p><p>We've been a little distracted with our "dogfood" projects: <a href="https://github.com/Textualize/frogmouth">Frogmouth</a> and <a href="https://github.com/Textualize/trogon">Trogon</a>. Both of which hit 1000 Github stars in 24 hours. We will be maintaining / updating those, but it is business as usual for this Textual release (and it's a big one). We have such sights to show you.</p>https://textual.textualize.io/blog/2023/06/01/textual-adds-sparklines-selection-list-input-validation-and-tool-tips/ Thu, 01 Jun 2023 17:41:08 +0000Textualhttps://textual.textualize.io/blog/2023/06/01/textual-adds-sparklines-selection-list-input-validation-and-tool-tips/ Textual 0.24.0 adds a Select control willmcgugan Release <h1>Textual 0.24.0 adds a Select control</h1><p>Coming just 5 days after the last release, we have version 0.24.0 which we are crowning the King of Textual releases.At least until it is deposed by version 0.25.0.</p>https://textual.textualize.io/blog/2023/05/08/textual-0240-adds-a-select-control/ Thu, 01 Jun 2023 11:33:54 +0000Textualhttps://textual.textualize.io/blog/2023/05/08/textual-0240-adds-a-select-control/ Textual 0.23.0 improves message handling willmcgugan Release <h1>Textual 0.23.0 improves message handling</h1><p>It's been a busy couple of weeks at Textualize.We've been building apps with <a href="https://github.com/Textualize/textual">Textual</a>, as part of our <em>dog-fooding</em> week.The first app, <a href="https://github.com/Textualize/frogmouth">Frogmouth</a>, was released at the weekend and already has 1K GitHub stars!Expect two more such apps this month.</p>https://textual.textualize.io/blog/2023/05/03/textual-0230-improves-message-handling/ Wed, 03 May 2023 13:22:22 +0000Textualhttps://textual.textualize.io/blog/2023/05/03/textual-0230-improves-message-handling/ Textual 0.11.0 adds a beautiful Markdown widget willmcgugan Release <h1>Textual 0.11.0 adds a beautiful Markdown widget</h1><p>We released Textual 0.10.0 25 days ago, which is a little longer than our usual release cycle. What have we been up to?</p>https://textual.textualize.io/blog/2023/02/15/textual-0110-adds-a-beautiful-markdown-widget/ Sat, 08 Apr 2023 15:35:49 +0000Textualhttps://textual.textualize.io/blog/2023/02/15/textual-0110-adds-a-beautiful-markdown-widget/ Textual 0.18.0 adds API for managing concurrent workers willmcgugan Release <h1>Textual 0.18.0 adds API for managing concurrent workers</h1><p>Less than a week since the last release, and we have a new API to show you.</p>https://textual.textualize.io/blog/2023/04/04/textual-0180-adds-api-for-managing-concurrent-workers/ Tue, 04 Apr 2023 13:12:51 +0000Textualhttps://textual.textualize.io/blog/2023/04/04/textual-0180-adds-api-for-managing-concurrent-workers/ Textual 0.17.0 adds translucent screens and Option List willmcgugan Release <h1>Textual 0.17.0 adds translucent screens and Option List</h1><p>This is a surprisingly large release, given it has been just 7 days since the last version (and we were down a developer for most of that time).</p><p>What's new in this release?</p>https://textual.textualize.io/blog/2023/03/29/textual-0170-adds-translucent-screens-and-option-list/ Wed, 29 Mar 2023 16:29:28 +0000Textualhttps://textual.textualize.io/blog/2023/03/29/textual-0170-adds-translucent-screens-and-option-list/ Textual 0.16.0 adds TabbedContent and border titles willmcgugan Release <h1>Textual 0.16.0 adds TabbedContent and border titles</h1><p>Textual 0.16.0 lands 9 days after the previous release. We have some new features to show you.</p>https://textual.textualize.io/blog/2023/03/22/textual-0160-adds-tabbedcontent-and-border-titles/ Wed, 22 Mar 2023 13:52:31 +0000Textualhttps://textual.textualize.io/blog/2023/03/22/textual-0160-adds-tabbedcontent-and-border-titles/ \ No newline at end of file diff --git a/guide/app/index.html b/guide/app/index.html index 2606acb19d..df408c0d31 100644 --- a/guide/app/index.html +++ b/guide/app/index.html @@ -6965,6 +6965,10 @@

    Run inlineApp.run(). See Style Inline Apps for how to apply additional styles to inline apps.

    +
    +

    Note

    +

    Inline mode is not currently supported on Windows.

    +

    Events

    Textual has an event system you can use to respond to key presses, mouse actions, and internal state changes. Event handlers are methods prefixed with on_ followed by the name of the event.

    One such event is the mount event which is sent to an application after it enters application mode. You can respond to this event by defining a method called on_mount.

    diff --git a/guide/queries/index.html b/guide/queries/index.html index 1b187dbe2f..ebccc3424c 100644 --- a/guide/queries/index.html +++ b/guide/queries/index.html @@ -6516,12 +6516,15 @@

    DOM QueriesSee the Textual Query Sandbox project for an interactive way of experimenting with DOM queries.

    Query one

    -

    The query_one method gets a single widget in an app or other widget. If you call it with a selector it will return the first matching widget.

    -

    Let's say we have a widget with an ID of send and we want to get a reference to it in our app. We could do this with the following:

    +

    The query_one method is used to retrieve a single widget that matches a selector or a type.

    +

    Let's say we have a widget with an ID of send and we want to get a reference to it in our app. +We could do this with the following line of code:

    send_button = self.query_one("#send")
     
    -

    If there is no widget with an ID of send, Textual will raise a NoMatches exception. Otherwise it will return the matched widget.

    -

    You can also add a second parameter for the expected type.

    +

    This will retrieve a widget with an ID of send, if there is exactly one. +If there are no matching widgets, Textual will raise a NoMatches exception. +If there is more than one match, Textual will raise a TooManyMatches exception.

    +

    You can also add a second parameter for the expected type, which will ensure that you get the type you are expecting.

    send_button = self.query_one("#send", Button)
     

    If the matched widget is not a button (i.e. if isinstance(widget, Button) equals False), Textual will raise a WrongType exception.

    @@ -6529,12 +6532,16 @@

    Query oneTip

    The second parameter allows type-checkers like MyPy to know the exact return type. Without it, MyPy would only know the result of query_one is a Widget (the base class).

    +

    You can also specify a widget type in place of a selector, which will return a widget of that type. +For instance, the following would return a Button instance (assuming there is a single Button).

    +
    my_button = self.query_one(Button)
    +

    Making queries

    -

    Apps and widgets have a query method which finds (or queries) widgets. This method returns a DOMQuery object which is a list-like container of widgets.

    +

    Apps and widgets also have a query method which finds (or queries) widgets. This method returns a DOMQuery object which is a list-like container of widgets.

    If you call query with no arguments, you will get back a DOMQuery containing all widgets. This method is recursive, meaning it will also return child widgets (as many levels as required).

    Here's how you might iterate over all the widgets in your app:

    -
    for widget in self.query():
    -    print(widget)
    +
    for widget in self.query():
    +    print(widget)
     

    Called on the app, this will retrieve all widgets in the app. If you call the same method on a widget, it will return the children of that widget.

    @@ -6544,12 +6551,12 @@

    Making queriesQuery selectors

    You can call query with a CSS selector. Let's look a few examples:

    If we want to find all the button widgets, we could do something like the following:

    -
    for button in self.query("Button"):
    -    print(button)
    +
    for button in self.query("Button"):
    +    print(button)
     

    Any selector that works in CSS will work with the query method. For instance, if we want to find all the disabled buttons in a Dialog widget, we could do this:

    -
    for button in self.query("Dialog Button.disabled"):
    -    print(button)
    +
    for button in self.query("Dialog Button.disabled"):
    +    print(button)
     

    Info

    @@ -6558,8 +6565,8 @@

    Query selectorsResults

    Query objects have a results method which is an alternative way of iterating over widgets. If you supply a type (i.e. a Widget class) then this method will generate only objects of that type.

    The following example queries for widgets with the disabled CSS class and iterates over just the Button objects.

    -
    for button in self.query(".disabled").results(Button):
    -    print(button)
    +
    for button in self.query(".disabled").results(Button):
    +    print(button)
     

    Tip

    @@ -6570,11 +6577,11 @@

    Query objectsFirst and last

    The first and last methods return the first or last matching widget from the selector, respectively.

    Here's how we might find the last button in an app:

    -
    last_button = self.query("Button").last()
    +
    last_button = self.query("Button").last()
     

    If there are no buttons, Textual will raise a NoMatches exception. Otherwise it will return a button widget.

    Both first() and last() accept an expect_type argument that should be the class of the widget you are expecting. Let's say we want to get the last widget with class .disabled, and we want to check it really is a button. We could do this:

    -
    disabled_button = self.query(".disabled").last(Button)
    +
    disabled_button = self.query(".disabled").last(Button)
     

    The query selects all widgets with a disabled CSS class. The last method gets the last disabled widget and checks it is a Button and not any other kind of widget.

    If the last widget is not a button, Textual will raise a WrongType exception.

    @@ -6585,28 +6592,28 @@

    First and lastFilter

    Query objects have a filter method which further refines a query. This method will return a new query object with widgets that match both the original query and the new selector.

    Let's say we have a query which gets all the buttons in an app, and we want a new query object with just the disabled buttons. We could write something like this:

    -
    # Get all the Buttons
    -buttons_query = self.query("Button")
    -# Buttons with 'disabled' CSS class
    -disabled_buttons = buttons_query.filter(".disabled")
    +
    # Get all the Buttons
    +buttons_query = self.query("Button")
    +# Buttons with 'disabled' CSS class
    +disabled_buttons = buttons_query.filter(".disabled")
     

    Iterating over disabled_buttons will give us all the disabled buttons.

    Exclude

    Query objects have an exclude method which is the logical opposite of filter. The exclude method removes any widgets from the query object which match a selector.

    Here's how we could get all the buttons which don't have the disabled class set.

    -
    # Get all the Buttons
    -buttons_query = self.query("Button")
    -# Remove all the Buttons with the 'disabled' CSS class
    -enabled_buttons = buttons_query.exclude(".disabled")
    +
    # Get all the Buttons
    +buttons_query = self.query("Button")
    +# Remove all the Buttons with the 'disabled' CSS class
    +enabled_buttons = buttons_query.exclude(".disabled")
     

    Loop-free operations

    Once you have a query object, you can loop over it to call methods on the matched widgets. Query objects also support a number of methods which make an update to every matched widget without an explicit loop.

    For instance, let's say we want to disable all buttons in an app. We could do this by calling add_class() on a query object.

    -
    self.query("Button").add_class("disabled")
    +
    self.query("Button").add_class("disabled")
     

    This single line is equivalent to the following:

    -
    for widget in self.query("Button"):
    -    widget.add_class("disabled")
    +
    for widget in self.query("Button"):
    +    widget.add_class("disabled")
     

    Here are the other loop-free methods on query objects:

    diff --git a/widgets/content_switcher/index.html b/widgets/content_switcher/index.html index 20d77343c9..df012ec4a2 100644 --- a/widgets/content_switcher/index.html +++ b/widgets/content_switcher/index.html @@ -7197,8 +7197,8 @@

    - instance-attribute class-attribute + instance-attribute

    diff --git a/widgets/data_table/index.html b/widgets/data_table/index.html index f6033ac775..14bd31f4db 100644 --- a/widgets/data_table/index.html +++ b/widgets/data_table/index.html @@ -11173,8 +11173,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -11367,8 +11367,8 @@

    - instance-attribute class-attribute + instance-attribute

    diff --git a/widgets/digits/index.html b/widgets/digits/index.html index 5efd7e1fe1..149a06a8a4 100644 --- a/widgets/digits/index.html +++ b/widgets/digits/index.html @@ -6718,132 +6718,132 @@

    Example + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - ClockApp + ClockApp - + - - - - - - - - - - - - ┓ ╺━┓   ╺━┓╺━┓   ╺━┓╺━┓ - ┃  ━┫ : ┏━┛ ━┫ :  ━┫┏━┛ -╺┻╸╺━┛   ┗━╸╺━┛   ╺━┛┗━╸ - - - - - - - - - - + + + + + + + + + + + + ┓ ╺━┓    ┓ ┏━┓   ╺━┓┏━┓ + ┃ ┏━┛ :  ┃ ┃ ┃ :  ━┫┗━┫ +╺┻╸┗━╸   ╺┻╸┗━┛   ╺━┛╺━┛ + + + + + + + + + + diff --git a/widgets/directory_tree/index.html b/widgets/directory_tree/index.html index 5d30b39cdd..0c1d449dc5 100644 --- a/widgets/directory_tree/index.html +++ b/widgets/directory_tree/index.html @@ -7348,8 +7348,8 @@

    - instance-attribute class-attribute + instance-attribute

    diff --git a/widgets/header/index.html b/widgets/header/index.html index 056d47b4ed..a99ba2401e 100644 --- a/widgets/header/index.html +++ b/widgets/header/index.html @@ -7061,8 +7061,8 @@

    - instance-attribute class-attribute + instance-attribute

    diff --git a/widgets/input/index.html b/widgets/input/index.html index cb5b76fa26..ae099a9e6d 100644 --- a/widgets/input/index.html +++ b/widgets/input/index.html @@ -8924,8 +8924,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -9068,8 +9068,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -9210,8 +9210,8 @@

    - instance-attribute class-attribute + instance-attribute

    diff --git a/widgets/list_item/index.html b/widgets/list_item/index.html index b0a4c59f2b..5b2e37614a 100644 --- a/widgets/list_item/index.html +++ b/widgets/list_item/index.html @@ -6743,8 +6743,8 @@

    - instance-attribute class-attribute + instance-attribute

    diff --git a/widgets/list_view/index.html b/widgets/list_view/index.html index 5d5c84cc85..1269c370e3 100644 --- a/widgets/list_view/index.html +++ b/widgets/list_view/index.html @@ -7412,8 +7412,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -7479,8 +7479,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -7623,8 +7623,8 @@

    - instance-attribute class-attribute + instance-attribute

    diff --git a/widgets/loading_indicator/index.html b/widgets/loading_indicator/index.html index 9ec059e49e..fe649a8307 100644 --- a/widgets/loading_indicator/index.html +++ b/widgets/loading_indicator/index.html @@ -6504,135 +6504,135 @@

    Example + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - LoadingApp + LoadingApp - + - - - - - - - - - - - - -● ● ● ●  - - - - - - - - - - - + + + + + + + + + + + + +● ● ● ●  + + + + + + + + + + + diff --git a/widgets/markdown/index.html b/widgets/markdown/index.html index 30fa8327ed..261f9d8d94 100644 --- a/widgets/markdown/index.html +++ b/widgets/markdown/index.html @@ -7260,8 +7260,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -7311,8 +7311,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -7335,8 +7335,8 @@

    - instance-attribute class-attribute + instance-attribute

    diff --git a/widgets/markdown_viewer/index.html b/widgets/markdown_viewer/index.html index 539a2be7d0..18453e4699 100644 --- a/widgets/markdown_viewer/index.html +++ b/widgets/markdown_viewer/index.html @@ -8013,8 +8013,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -8064,8 +8064,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -8088,8 +8088,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -9027,7 +9027,7 @@
    Parameters
    @@ -9220,7 +9220,7 @@
    Raises
    @@ -9303,7 +9303,7 @@
    Raises
    @@ -9362,7 +9362,7 @@
    Raises
    @@ -9445,7 +9445,7 @@
    Raises
    @@ -9528,7 +9528,7 @@
    Raises
    @@ -9611,7 +9611,7 @@
    Raises
    @@ -9694,7 +9694,7 @@
    Raises
    @@ -9777,7 +9777,7 @@
    Raises
    @@ -9871,7 +9871,7 @@
    Raises
    @@ -9965,7 +9965,7 @@
    Raises
    diff --git a/widgets/progress_bar/index.html b/widgets/progress_bar/index.html index b9452f7485..a917d38ee3 100644 --- a/widgets/progress_bar/index.html +++ b/widgets/progress_bar/index.html @@ -8582,8 +8582,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -8619,8 +8619,8 @@

    - instance-attribute class-attribute + instance-attribute

    diff --git a/widgets/radiobutton/index.html b/widgets/radiobutton/index.html index 25fb70988c..b078e3a14f 100644 --- a/widgets/radiobutton/index.html +++ b/widgets/radiobutton/index.html @@ -6910,8 +6910,8 @@

    - instance-attribute class-attribute + instance-attribute

    diff --git a/widgets/radioset/index.html b/widgets/radioset/index.html index a846e3c9b6..9c37933de7 100644 --- a/widgets/radioset/index.html +++ b/widgets/radioset/index.html @@ -7538,8 +7538,8 @@

    - instance-attribute class-attribute + instance-attribute

    diff --git a/widgets/select/index.html b/widgets/select/index.html index bf84e60e86..52efedeeb3 100644 --- a/widgets/select/index.html +++ b/widgets/select/index.html @@ -7862,8 +7862,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -7899,8 +7899,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -7923,8 +7923,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -7971,8 +7971,8 @@

    - instance-attribute class-attribute + instance-attribute

    diff --git a/widgets/selection_list/index.html b/widgets/selection_list/index.html index bfd60142a4..52e59442c5 100644 --- a/widgets/selection_list/index.html +++ b/widgets/selection_list/index.html @@ -8140,8 +8140,8 @@

    - instance-attribute class-attribute + instance-attribute

    diff --git a/widgets/sparkline/index.html b/widgets/sparkline/index.html index a20ffdb20c..7183694f98 100644 --- a/widgets/sparkline/index.html +++ b/widgets/sparkline/index.html @@ -8041,8 +8041,8 @@

    - instance-attribute class-attribute + instance-attribute

    diff --git a/widgets/switch/index.html b/widgets/switch/index.html index e53d39c459..c5256e4825 100644 --- a/widgets/switch/index.html +++ b/widgets/switch/index.html @@ -7165,8 +7165,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -7189,8 +7189,8 @@

    - instance-attribute class-attribute + instance-attribute

    diff --git a/widgets/tabbed_content/index.html b/widgets/tabbed_content/index.html index b833b91be4..88abd89c8b 100644 --- a/widgets/tabbed_content/index.html +++ b/widgets/tabbed_content/index.html @@ -7737,8 +7737,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -8003,8 +8003,8 @@

    - instance-attribute class-attribute + instance-attribute

    diff --git a/widgets/tabs/index.html b/widgets/tabs/index.html index 925f6eab3d..b627ef27d2 100644 --- a/widgets/tabs/index.html +++ b/widgets/tabs/index.html @@ -7760,8 +7760,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -8176,8 +8176,8 @@

    - instance-attribute class-attribute + instance-attribute

    diff --git a/widgets/text_area/index.html b/widgets/text_area/index.html index 908483516c..116f41ab84 100644 --- a/widgets/text_area/index.html +++ b/widgets/text_area/index.html @@ -11807,7 +11807,7 @@
    Example - adding Java support @@ -12304,8 +12304,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -12852,8 +12852,8 @@
    @@ -13038,8 +13038,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -13115,8 +13115,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -13167,8 +13167,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -13216,8 +13216,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -13246,8 +13246,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -13273,8 +13273,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -16925,8 +16925,8 @@

    - property abstractmethod + property

    @@ -16949,8 +16949,8 @@

    - property abstractmethod + property

    @@ -16973,8 +16973,8 @@

    - property abstractmethod + property

    @@ -17000,8 +17000,8 @@

    - property abstractmethod + property

    @@ -17024,8 +17024,8 @@

    - property abstractmethod + property

    @@ -17048,8 +17048,8 @@

    - property abstractmethod + property

    @@ -19586,8 +19586,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -19634,8 +19634,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -20188,8 +20188,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -20212,8 +20212,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -20236,8 +20236,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -20261,8 +20261,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -20285,8 +20285,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -20309,8 +20309,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -20356,8 +20356,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -20380,8 +20380,8 @@

    - instance-attribute class-attribute + instance-attribute

    diff --git a/widgets/tree/index.html b/widgets/tree/index.html index 4e4b7e5add..d30155becc 100644 --- a/widgets/tree/index.html +++ b/widgets/tree/index.html @@ -8409,8 +8409,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -8433,8 +8433,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -8480,8 +8480,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -8504,8 +8504,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -8574,8 +8574,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -8598,8 +8598,8 @@

    - instance-attribute class-attribute + instance-attribute

    markdown
    - Markdown + Markdown
    required @@ -9124,8 +9124,8 @@

    - instance-attribute class-attribute + instance-attribute

    diff --git a/widgets/option_list/index.html b/widgets/option_list/index.html index b742c59b21..fab3f88de0 100644 --- a/widgets/option_list/index.html +++ b/widgets/option_list/index.html @@ -8406,8 +8406,8 @@

    - instance-attribute class-attribute + instance-attribute

    @@ -9161,7 +9161,7 @@
    Raises
    - OptionDoesNotExist + OptionDoesNotExist

    If no option has the given ID.

    - OptionDoesNotExist + OptionDoesNotExist

    If there is no option with the given index.

    - OptionDoesNotExist + OptionDoesNotExist

    If no option has the given ID.

    - OptionDoesNotExist + OptionDoesNotExist

    If there is no option with the given index.

    - OptionDoesNotExist + OptionDoesNotExist

    If no option has the given ID.

    - OptionDoesNotExist + OptionDoesNotExist

    If there is no option with the given index.

    - OptionDoesNotExist + OptionDoesNotExist

    If no option has the given ID.

    - OptionDoesNotExist + OptionDoesNotExist

    If no option has the given ID.

    - OptionDoesNotExist + OptionDoesNotExist

    If there is no option with the given index.

    - OptionDoesNotExist + OptionDoesNotExist

    If no option has the given ID.

    - OptionDoesNotExist + OptionDoesNotExist

    If there is no option with the given index.