diff --git a/src/streamlit_app.py b/src/streamlit_app.py index 027e7f9..d00f7f0 100644 --- a/src/streamlit_app.py +++ b/src/streamlit_app.py @@ -213,7 +213,15 @@ with col1: root = tk.Tk() root.withdraw() root.wm_attributes('-topmost', 1) - path = filedialog.askdirectory(title="Select Source Directory") + root.after(10) # Add a small delay + # Create and run the main loop in a way that doesn't block + path = None + def select_dir(): + nonlocal path + path = filedialog.askdirectory(title="Select Source Directory") + root.quit() + root.after(20, select_dir) + root.mainloop() if path: st.session_state['source_dir_selected'] = path st.rerun() @@ -262,7 +270,15 @@ with col1: root = tk.Tk() root.withdraw() root.wm_attributes('-topmost', 1) - path = filedialog.askdirectory(title="Select Destination Directory") + root.after(10) # Add a small delay + # Create and run the main loop in a way that doesn't block + path = None + def select_dir(): + nonlocal path + path = filedialog.askdirectory(title="Select Destination Directory") + root.quit() + root.after(20, select_dir) + root.mainloop() if path: st.session_state['dest_dir_selected'] = path st.rerun()