James McCool commited on
Commit
6594d81
·
1 Parent(s): 886a898

Refactor player position selection in app.py

Browse files

- Introduced a form for player position selection, enhancing user interaction by allowing submission of choices.
- Updated the logic to handle specific and all position selections more effectively, improving the overall filtering experience.

Files changed (1) hide show
  1. app.py +11 -7
app.py CHANGED
@@ -318,14 +318,18 @@ with tab2:
318
  with st.container():
319
  tab1, tab2, tab3, tab4 = st.tabs(['Player Used Info', 'Stack Used Info', 'Stack Size Info', 'General Info'])
320
  with tab1:
321
- col1, col2 = st.columns(2)
322
- with col1:
323
- pos_var = st.selectbox("Which position(s) would you like to view?", ['All', 'Specific'], key='pos_var')
324
- with col2:
325
- if pos_var == 'Specific':
326
  pos_select = st.multiselect("Select your position(s)", ['P', 'C', '1B', '2B', '3B', 'SS', 'OF'], key='pos_select')
327
- else:
328
- pos_select = None
 
 
 
 
329
 
330
  if entry_parse_var == 'All':
331
 
 
318
  with st.container():
319
  tab1, tab2, tab3, tab4 = st.tabs(['Player Used Info', 'Stack Used Info', 'Stack Size Info', 'General Info'])
320
  with tab1:
321
+ with st.form(key='player_info_pos_form'):
322
+ col1, col2 = st.columns(2)
323
+ with col1:
324
+ pos_var = st.selectbox("Which position(s) would you like to view?", ['All', 'Specific'], key='pos_var')
325
+ with col2:
326
  pos_select = st.multiselect("Select your position(s)", ['P', 'C', '1B', '2B', '3B', 'SS', 'OF'], key='pos_select')
327
+ submitted = st.form_submit_button("Submit")
328
+ if submitted:
329
+ if pos_var == 'Specific':
330
+ pos_select = pos_select
331
+ else:
332
+ pos_select = None
333
 
334
  if entry_parse_var == 'All':
335