spirali / nelsie

Framework for Creating Slides
MIT License
24 stars 2 forks source link

[Feature Request] : Helper to build tables with separators? #50

Open galenseilis opened 1 week ago

galenseilis commented 1 week ago

As a data scientist, I often need to give tables of values in my presentations.

I looked at some related issues and documentation:

I tried this example (migrated to Nelsie from the Elsie documentation):

@deck.slide()
def another_table(slide):
    row_count = 2
    column_count = 3

    for r in range(row_count):
        row = slide.box(row=True, p_bottom=10)
        for c in range(column_count):
            box = row.box(width=100, height=100, p_right=10)
            box.text(f"({r}, {c})", TextStyle(color="black"))

It created a grid of entries, which is a good start!

image

I would like it to be relatively easy to make something like this (image taken from Google images): image

Similar to tabular in LaTeX, it is possible to declare where line separators exist among the rows and columns.

I'm not sure what the Nelsie-idiomatic way to do this is.

Would it be possible to implement a function that assists in putting together tables with separators?

spirali commented 1 week ago

In the current version, there is no better way than you have shown. The problem is that flexbox layout is one-dimensional. I am going to expose the grid layout in the next version of Nelsie, so creating tables should be more easier.