pyosv.utils.paths
1from tkinter.filedialog import askopenfilename 2from tkinter import Tk 3 4 5def get_path_gui() -> str: 6 7 ''' 8 Get the path of a file using a graphical menu 9 10 Parameters: 11 ----------- 12 Nothing 13 14 Returns: 15 -------- 16 - path: path of the image 17 18 Usage: 19 ------ 20 21 ```python 22 path = get_path_gui() 23 ``` 24 25 Output: 26 ------- 27 ``` 28 /path/to/file/img.png 29 ``` 30 31 ''' 32 33 root = Tk() 34 root.withdraw() 35 path = askopenfilename( 36 title='Select the file or the folder!', 37 initialdir='/' 38 ) 39 root.destroy() 40 41 return path
def
get_path_gui() -> str:
6def get_path_gui() -> str: 7 8 ''' 9 Get the path of a file using a graphical menu 10 11 Parameters: 12 ----------- 13 Nothing 14 15 Returns: 16 -------- 17 - path: path of the image 18 19 Usage: 20 ------ 21 22 ```python 23 path = get_path_gui() 24 ``` 25 26 Output: 27 ------- 28 ``` 29 /path/to/file/img.png 30 ``` 31 32 ''' 33 34 root = Tk() 35 root.withdraw() 36 path = askopenfilename( 37 title='Select the file or the folder!', 38 initialdir='/' 39 ) 40 root.destroy() 41 42 return path
Get the path of a file using a graphical menu
Parameters:
Nothing
Returns:
- path: path of the image
Usage:
path = get_path_gui()
Output:
/path/to/file/img.png