pong / net.py
schen357's picture
Update net.py
7b3ee29
Raw
History Blame Contribute Delete
628 Bytes
import streamlit as st
import pandas as pd
# Define the net properties
NET_LENGTH = 10 # Adjust as needed
NET_COLOR = "white"
# Function to create the net
def make_net():
# Create a DataFrame to represent the net
net_data = {'Net': ['|' if i % 2 == 0 else ' ' for i in range(NET_LENGTH)]}
net_df = pd.DataFrame(net_data)
return net_df
# Creating the net
net_df = make_net()
# Display the net using Streamlit
st.dataframe(net_df.style.applymap(lambda x: f'color: {NET_COLOR};', subset=['Net']), height=600)
Explanation:
Creating the Net: The function make_net creates a simple representation of the net