-
Notifications
You must be signed in to change notification settings - Fork 0
/
__init__.py
29 lines (18 loc) · 850 Bytes
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import os
from tkinter import filedialog
def get_multiple_files_with_tkinter(filetypes=((".txt", "*.txt"),)):
files = filedialog.askopenfilename(filetypes=filetypes, multiple=True)
files = [os.path.normpath(x) for x in files]
return files
def get_file_with_tkinter(filetypes=((".txt", "*.txt"),)):
file = filedialog.askopenfilename(filetypes=filetypes, multiple=False)
return os.path.normpath(file)
def get_save_file_with_tkinter(filetypes=((".txt", "*.txt"),)):
file = filedialog.asksaveasfilename(filetypes=filetypes)
return os.path.normpath(file)
def get_existing_directory_with_tkinter():
file = filedialog.askdirectory(mustexist=True)
return os.path.normpath(file)
def get_not_existing_directory_with_tkinter():
file = filedialog.askdirectory(mustexist=False)
return os.path.normpath(file)