Skip to content
Discussion options

You must be logged in to vote

DataTable has no direct method of adding a column of data, so how to populate a table when the data is column rather than row-orientated?

I've created a quick example based on the data from the docs, but let me know if there is a more efficient way!

from itertools import zip_longest

from textual.app import App, ComposeResult
from textual.widgets import DataTable

DATA = {
    "lane": [4, 2, 5, 6, 3, 8, 7, 1, 10],
    "swimmer": [
        "Joseph Schooling",
        "Michael Phelps",
        "Chad le Clos",
        "László Cseh",
        "Li Zhuhao",
        "Mehdy Metella",
        "Tom Shields",
        "Aleksandr Sadovnikov",
        "Darren Burns",
    ],
    "country": [
        "Sin…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
4 replies
@komidan
Comment options

@davep
Comment options

@komidan
Comment options

@davep
Comment options

Comment options

You must be logged in to vote
1 reply
@komidan
Comment options

Answer selected by komidan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants