Article Summary:
Learn how to write Python TUI (Text User Interfaces) using Textual, a poweful yet easy to use framework to write and debug applications that run on the terminal.
Article Description:
Python on Linux has nice GUI (Graphic User Interface) development libraries like TkInter, but what if you cannot run graphical applications?
Text terminals, are available on not just Linux but BSD and other great Unix like operating systems. And if you write code in Python you should be using Textual
So what is Textual?
Textual is a Rapid Application Development framework for Python, built by Textualize.io. Build sophisticated user interfaces with a simple Python API. Run your apps in the terminal or a web browser!
In this quick introduction, I will show you 2 examples of what you can do with Textual and where you can go after that
What do you need to follow this tutorial You will need the following:
Basic programing experience, preferable in Python. Understanding basic OO concepts like classes, inheritance A machine with Linux and Python 3.9+ installed A good editor (Vim, PyCharm are good choices) I tried to keep the code simple, so you can follow it. Also, I strongly recommend you download the code or at least install the programs as explained next.
Textual is %100 Open Source and the article comes with code too:
GitHub Pypi A preview of the article is on the following location
github.com josevnz/tutorials/blob/main/docs/Textualize/TUTORIAL.md
You will need the following:
1) Basic programing experience, preferable in Python. 2) Understanding basic OO concepts like classes, inheritance 3) A machine with Linux and Python 3.9+ installed This file has been truncated. show original I think it would be a nice compliment for the following article: Writing useful terminal TUI on Linux with dialog and jq - Fedora Magazine
I was looking for a way to add this to https://pagure.io/fedora-magazine-newsroom/boards/articles but looks like you have to do it first.
Please let me know what you think.
Thanks.
https://discussion.fedoraproject.org/t/article-proposal-crash-course-to-textual/100517
Metadata Update from @glb: - Issue assigned to josevnz
Metadata Update from @glb: - Issue tagged with: article, needs-image
I started working on the article:
https://fedoramagazine.org/?p=39569&preview=true&preview_id=39569
Code formatting needs love, and some heavy editing is needed. Will post here again once the article is ready for formal review.
OK, it looks much better now, can you guys take a look and let me know what you think? Thanks.
Metadata Update from @rlengland: - Custom field preview-link adjusted to https://fedoramagazine.org/?p=39569&preview=true&preview_id=39569
@josevnz Your article looks pretty good. I made a few changes to simplify some sentences but no major changes. I did notice two things.
First, your images are "embedded" in the article, meaning that they are not loaded in the Magazine media repository. This means that we can't create a link to the image which would allow the user to select the image and display, enlarged, in a second window. This isn't a major issues, it simply means that a reader who wishes to enlarge the image will have to select the image and open it in a new window or tab in their browser. If you want to change this feel free but it isn't absolutely required. It's just nicer for the reader.
Second, I noticed a reference in the "Using screens to show more complex views" section to "...override the method start..." (this is in the first bullet item after the CustomerCommand(Provider) code block. I'm by no means a good Python coder but I saw no reference to the "start" method, only the "startup" method. I could be missing something entirely but I thought I would bring it to your attention. Educate me :-)
Metadata Update from @rlengland: - Custom field editor adjusted to rlengland - Custom field image-editor adjusted to rlengland
Hello @rlengland,
Thanks for the edit. Also you are correct about the start correction, I changed it to startup as it should be.
I would like to keep the images like this, I promise to do a separate upload for the next article (oh, yes, there is a next article), with more tools and and more interesting back story.
I do not have a featured image for this one, maybe you can suggest one (I really like the previous ones)
Thanks!
@josevnz Looks good. I've added a feature image. If it meets your approval we can publish this tomorrow (Wed 10 Jan)
NIce, let's publish it.
Thanks a lot for the quick turnaround.
Scheduled for 10 January 08:00 UTC.
Thanks for your contribution to the Fedora Magazine, @josevnz
Issue status updated to: Closed (was: Open) Issue close_status updated to: published
Log in to comment on this ticket.