Locked learning resources

Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Building UIs in the Terminal With Python Textual (Summary)

You’ve learned how to build text-based user interface (TUI) apps for the terminal using the Python Textual framework. You’ve also explored how to create, style, and enhance Textual apps with various widgets, layouts, events, and actions.

Textual is a great library for Python developers who want to create efficient and platform-independent TUI apps, especially in environments where graphical user interfaces may not be feasible.

In this video course, you’ve learned how to:

  • Install and set up Textual for building text-based interface apps
  • Create and style widgets using Python code and TCSS
  • Build and lay out user interfaces with Textual containers
  • Handle events and actions to make your applications interactive

Resources linked in this lesson:

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Already a member? Sign-In

00:00 In the previous lesson, I showed you a complete Textual application. In this lesson, I’ll summarize the course and point you at further resources.

00:08 Textual is a powerful terminal user interface library that allows you to create GUI-like applications within your terminal. Like with a GUI, it comes with a variety of widgets that you can use, including text, widgets, buttons, inputs, including password boxes, digit displays, and much more.

00:26 You use a simplified version of CSS called TCSS, along with a hierarchy of containers to manage the layout and styling of your application, and you associate the code that you want to run when a user does something in your app through Textual’s event system.

00:42 It also has a shortcut for event handling called actions, which reduces the amount of code you need.

00:49 Textual is very well documented, and the website includes tutorials, guides, documentation, and a deep reference on the API. There’s also a Discord server with a very active community, including channels for showing off what you made and getting help from others.

01:04 Textual is an open-source project and is written solely in Python, so you can always dig into the code if you want more information on how something works.

01:12 The source code repo at GitHub includes an examples directory containing over a dozen programs that show off Textual’s capabilities, which act as a great source of ideas and help you better understand the approach you might take when coding your own app.

01:27 The transcendent Textual GitHub repo is a list of Textual apps and libraries. If you’re looking for more examples, or maybe just a tool you want to try out, this is a good place to start.

01:38 Throughout this course, you’ve actually seen more examples of Textual than you may have realized. The code demonstration tool that I use is called Purdy, and it was recently rewritten in Textual.

01:48 Feel free to check it out. Or if you’d like to see a completely different approach to TUI, try Asciimatics. This also uses terminal escape sequences to do funky stuff, but it focuses more on animations and wizardry.

02:02 It’s got a very eighties demo scene vibe to it.

02:07 There’s always more content at Real Python you can check out. This how-to tutorial shows you how to build an address book contact app using Textual with SQLite as the data store.

02:17 Before Textual there was Rich. If you don’t need a fully interactive app, but want to take advantage of some of the styling concepts in Textual, Rich might be the right thing for you.

02:27 There’s both a video course and tutorial on how to use Rich to enhance your program’s output. If you’d like to go from TUI-land to GUI-land, there’s a ton of content.

02:38 This topic path has many courses and tutorials for you to learn a variety of frameworks, including Tkinter, PyQt, Kivy, and more.

02:50 That’s all for now. I hang out on the Textual Discord server. I’d love to see what you create with Textual. Show it off in the show and tell channel. Thanks for your attention.

03:00 I hope you enjoyed the course.

Become a Member to join the conversation.