I have figured out how to use columns to section off elements and have learned how to use functions to simplify the process of displaying grouped elements, but one thing I cant seem to figure out is how to shift elements because my goal is for every card_widget to push the previous one out of the way, that way the newest one is at the leftmost and topmost part of the page. Does anyone know how to do that?
This is the code I have so far, Ill attach some images below to give a visual representation for what im trying to achieve.
import streamlit as st
st.set_page_config(page_title="Card GUI", layout="wide")
cols = st.columns([3, 3, 3, 3, 3, 3, 3, 3], gap="small")
def card_widget(name, image, rarity, trait, col):
cols[col].text(name)
cols[col].image(image)
cols[col].text('Rarity: '+ rarity)
cols[col].text('Trait: '+ trait)
I’m not sure how to replicate this where the newest one shifts the other one to the right or to the next row like this. Thanks ahead of time!