Spaces:
Running
Running
James McCool
commited on
Commit
·
a591260
1
Parent(s):
3d22992
Add clear and save lineup buttons in app.py to enhance user interaction. The clear button resets the lineup, while the save button allows users to store their lineups in session state, improving overall functionality and user experience.
Browse files
app.py
CHANGED
@@ -1385,6 +1385,17 @@ with tab4:
|
|
1385 |
)
|
1386 |
|
1387 |
# Optionally, add a button to clear the lineup
|
1388 |
-
|
1389 |
-
|
1390 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1385 |
)
|
1386 |
|
1387 |
# Optionally, add a button to clear the lineup
|
1388 |
+
clear_col, save_col, blank_col = st.columns([2,2,8])
|
1389 |
+
with clear_col:
|
1390 |
+
if st.button("Clear Lineup", key='clear_lineup'):
|
1391 |
+
st.session_state['handbuilder_lineup'] = pd.DataFrame(columns=['Player', 'Position', 'Team', 'Team_Total', 'Opp_Total', 'Salary', 'Median', '2x%', 'Own%', 'Slot', 'Order'])
|
1392 |
+
st.rerun()
|
1393 |
+
with save_col:
|
1394 |
+
if st.button("Save Lineup", key='save_lineup'):
|
1395 |
+
if 'saved_lineups' in st.session_state:
|
1396 |
+
st.session_state['saved_lineups'].append(st.session_state['handbuilder_lineup']['Player'].tolist())
|
1397 |
+
print(st.session_state['saved_lineups'])
|
1398 |
+
else:
|
1399 |
+
st.session_state['saved_lineups'] = [st.session_state['handbuilder_lineup']['Player'].tolist()]
|
1400 |
+
print(st.session_state['saved_lineups'])
|
1401 |
+
st.rerun()
|