Building the Interface Widgets
Learn how to build the terminal-based interface for our Pomodoro application.
Now that the business logic is ready and tested, we can build the terminal interface for our Pomodoro application. We’ll create the basic interface that has the controls required to run and display the Pomodoro status.
Building the interface
To create this interface, we’ll use the Termdash dashboard library. Termdash is a good option because it’s cross-platform, it’s under active development, and it has a good set of features.
Among these features, Termdash provides a variety of graphical widgets, dashboard resizing, a customizable layout, and handling of mouse and keyboard events. For more information about Termdash, with a complete list of features, consult the project’s page. Termdash relies on other libraries to run as the backend. For these examples, we’ll use the Tcell back-end library as it’s currently being developed and maintained.
Before we dive into designing the interface, let’s review each of its four main sections, as shown in the following images.
The Timer
section presents the time left in the current interval both in text form and in a graphical donut shape that fills up as time progresses.
We’ll implement the donut interface using the Donut Termdash widget and the text timer using Termdash’s Text widget.
The Type
section displays the current interval’s type or category. We’ll implement this section using the SegmentDisplay widget from Termdash.
The Info section presents relevant user messages and statuses. We’ll implement this item with the Text widget.
The Buttons ...