Bringing Tables to Life
00:00 Bringing tables to life. If you are working with a lot of data, then often a table is the most compact way to present it, but displaying data tables can be a little dry.
00:12 In this section, you’ll see how you can use Rich’s table building tools along with formatting and colorization to build a table that really grabs the user’s attention.
00:23
Building a static table. Rich has a Table
class that lets you build tabular data. Displays on screen is an example that shows how you can set formats and colors on a per column basis.
00:37
First, the relevant imports are performed: Console
and Table
. Next, a Console
is created, followed by a Table
.
00:54 The table columns are then added, setting the header text, the style, and justification.
01:35 A dictionary is then created containing the information to be displayed in the table for each element.
02:32 The rows are then added to the table by iterating over the dictionary members, adding text for each column in the order they were defined earlier on.
03:05
Finally, the table is printed to the console. Table
is a convenient way of presenting this kind of data. As you can see on screen, the Table
API gives you an intuitive way of building a nice looking tabular display with Rich, taking care of the implementation details.
03:29 In the next section of the course, you’ll see how Rich can give you more help with tables creating a scrolling table display.
Become a Member to join the conversation.