Skip to content

Commit 69260a3

Browse files
authored
added basic folder selection function
1 parent b552370 commit 69260a3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

utility.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
"""utility.py contains custom functions to be used in other scripts/modules"""
33

44
import os
5+
import tkinter as tk
6+
from tkinter import filedialog
57

68
def clear_console():
79
"""
@@ -11,3 +13,12 @@ def clear_console():
1113
os.system('cls') # For Windows
1214
else:
1315
os.system('clear') # For Unix/Linux/Mac
16+
17+
def select_folder(title="Select Folder"):
18+
"""
19+
Opens a folder selection dialog and returns the selected folder path.
20+
"""
21+
root = tk.Tk()
22+
root.withdraw() # Hide the main window
23+
folder_path = filedialog.askdirectory(title=title)
24+
return folder_path

0 commit comments

Comments
 (0)