diff --git a/src/streamlit_app.py b/src/streamlit_app.py index d00f7f0..18b289a 100644 --- a/src/streamlit_app.py +++ b/src/streamlit_app.py @@ -215,14 +215,14 @@ with col1: root.wm_attributes('-topmost', 1) root.after(10) # Add a small delay # Create and run the main loop in a way that doesn't block - path = None + path_holder = [] def select_dir(): - nonlocal path path = filedialog.askdirectory(title="Select Source Directory") + path_holder.append(path) root.quit() root.after(20, select_dir) root.mainloop() - if path: + if path_holder and path_holder[0]: st.session_state['source_dir_selected'] = path st.rerun() root.destroy() @@ -272,14 +272,14 @@ with col1: root.wm_attributes('-topmost', 1) root.after(10) # Add a small delay # Create and run the main loop in a way that doesn't block - path = None + path_holder = [] def select_dir(): - nonlocal path path = filedialog.askdirectory(title="Select Destination Directory") + path_holder.append(path) root.quit() root.after(20, select_dir) root.mainloop() - if path: + if path_holder and path_holder[0]: st.session_state['dest_dir_selected'] = path st.rerun() root.destroy()