Loading video player…

Building UIs in the Terminal With Python Textual (Overview)

Have you ever wanted to create an app with an appealing interface that works in the command line? Welcome to Textual, a Python toolkit and framework for creating beautiful, functional text-based user interface (TUI) applications. The Textual library provides a powerful and flexible framework for building TUIs. It offers a variety of features that allow you to create interactive and engaging console applications.

In this video course, you’ll learn how to create, style, and enhance Textual apps with layouts, events, and actions.

By the end of this video course, you’ll understand that:

  • Python Textual is a framework for building terminal-based applications with interactive and visually appealing text interfaces.
  • Textual works by providing a set of widgets, layouts, and styling options, enabling you to create responsive and interactive console apps.
  • Textual is useful for building efficient, platform-independent text-based user interfaces that work over remote connections and in low-resource environments.
Download

Course Slides (.pdf)

869.4 KB
Download

Sample Code (.zip)

5.8 KB

00:00 Welcome to Building UIs in the Terminal With Python Textual. My name is Christopher, and I will be your guide.

00:08 This course is all about the Textual third-party library, which you can use for building interactive programs in your terminal. A program that uses Textual is known as an app.

00:18 Inside the app, you use different kinds of widgets to compose an interface. Textual supports a wide variety of widgets, so this course will cover just some of the key ones, like those used to display text, as well as buttons and user input. Similar to their GUI cousins, terminal applications, like those built with Textual, are event-based.

00:40 Your code gets triggered based on an event like the user pressing a button. Textual also has a way of writing less code for event handlers known as actions.

00:50 Both of these get covered in this course.

00:54 This course was tested using Python 3.13.5. Python 3.14 was out at the time of recording, but Textual had not yet released a compatible version. That said, I’ve used Textual fine with 3.14. Only the debugging console had an issue due to the changes in how async code works in 3.14. The Textual libraries I used were the core 6.2.1, and the development kit for debugging 1.7.0.

01:24 Textual is a TUI framework. That’s TUI for terminal user interface. A TUI is like a GUI, an interactive program made up of widgets.

01:35 TUIs achieve this by using terminal control sequences to position blocks and lines. Of course, that means the interface is a little chunkier than a pixel-perfect GUI, but you’d be surprised just how much you can accomplish.

01:48 By focusing on the terminal, and being a Python library, your TUI is more or less independent of the operating system. Different OSs come with different terminals, so you may have restrictions on how many colors can be used at once, but for the most part, if you can open a terminal, you can use a Textual application.

02:05 Textual is a robust framework coming with pretty much anything you need to build your TUI, including a large number of widgets. And proof of that is just how many Textual applications are out there.

02:16 I’ve seen everything from a Postman clone to a piano, but this course isn’t about using Textual apps, but building them. You’ll learn all about how to write and style an app, and how to compose widgets together to create your own TUI.

02:31 Next up, you’ll hit the ground running with a Textual “Hello world!”

Become a Member to join the conversation.