James McCool commited on
Commit
f481ff1
·
1 Parent(s): c16cb6d

Add reset functionality to player selection in app.py

Browse files

- Introduced a reset button that clears player selection and resets related variables to their default states, improving user experience by allowing easy reconfiguration of player choices.

Files changed (1) hide show
  1. app.py +17 -1
app.py CHANGED
@@ -251,7 +251,23 @@ with tab2:
251
  unique_players = [p for p in unique_players if p != 'nan'] # Remove any NaN values
252
  player_parse_var = st.selectbox("Do you want to view lineups with specific player(s)?", ['All', 'Specific'], key = 'player_parse_var')
253
  player_names = st.multiselect("Select players", options=unique_players, default=[], key = 'player_names')
254
- submitted = st.form_submit_button("Submit")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
255
  if submitted:
256
  if 'player_frame' in st.session_state:
257
  del st.session_state['player_frame']
 
251
  unique_players = [p for p in unique_players if p != 'nan'] # Remove any NaN values
252
  player_parse_var = st.selectbox("Do you want to view lineups with specific player(s)?", ['All', 'Specific'], key = 'player_parse_var')
253
  player_names = st.multiselect("Select players", options=unique_players, default=[], key = 'player_names')
254
+ submit_col, reset_col, blank_col = st.columns([1, 1, 8])
255
+ with submit_col:
256
+ submitted = st.form_submit_button("Submit")
257
+ with reset_col:
258
+ reset = st.form_submit_button("Reset")
259
+ if reset:
260
+ entry_names = []
261
+ low_entries_var = 1
262
+ high_entries_var = 150
263
+ stack_names = []
264
+ stack_size_names = []
265
+ player_names = []
266
+ player_parse_var = 'All'
267
+ stack_parse_var = 'All'
268
+ stack_size_parse_var = 'All'
269
+ entry_parse_var = 'All'
270
+
271
  if submitted:
272
  if 'player_frame' in st.session_state:
273
  del st.session_state['player_frame']