File size: 798 Bytes
0e8c927
 
 
1c0e2a5
7b28238
 
 
 
 
 
 
 
0e8c927
 
 
 
 
1c0e2a5
0e8c927
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import streamlit as st
import math

def gridder(items):
    """Creates a grid for displaying items in a batched manner.
    Args:
        items (list): The items to be displayed.
    Returns:
        batch_size (int): The number of items to display in each batch.
        row_size (int): The number of items to display in each row.
        page (int): The range of pages available based on the number of items.
    """
    cols = st.columns(3)
    with cols[0]:
        batch_size = st.select_slider("Batch size:",range(10,110,10), value=10)
    with cols[1]:
        row_size = st.select_slider("Row size:", range(1,6), value = 5)
    num_batches = math.ceil(len(items)/batch_size)
    with cols[2]:
        page = st.selectbox("Page", range(1,num_batches+1))
    return batch_size, row_size, page