-
Notifications
You must be signed in to change notification settings - Fork 0
/
promptuser.py
59 lines (56 loc) · 1.66 KB
/
promptuser.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
def pufiles():
'''
tkinter GUI: Prompts the User to choose one/some Files
Returns a list of all file-paths
'''
from tkinter.filedialog import askopenfilenames
names = list(askopenfilenames(initialdir=".",
filetypes =(("All Files","*.*"),),
title = "Choose some files."
))
try:
global imagetargets
imagetargets = names
return names
except:
return False
def pufile():
'''
tkinter GUI: Prompts the User to choose one Files
Returns a string of the file-path
'''
from tkinter.filedialog import askopenfilename
name = askopenfilename(initialdir=".",
filetypes =(("All Files","*.*"),),
title = "Choose a file."
)
try:
global imagetarget
imagetarget = name
return name
except:
return False
def pudir():
'''
tkinter GUI: Prompts the User to choose a Directory (imagebase)
Returns a string of the Dir-path
'''
from tkinter.filedialog import askdirectory
name = askdirectory(initialdir=".",
title = "Choose a folder."
)
try:
global imagebase
imagebase = name
return name
except:
return False
def pusavefile():
from tkinter.filedialog import asksaveasfilename
name = asksaveasfilename(initialdir=".",filetypes =(("All Files","*.*"),),
title = "Choose a Filename."
)
try:
return name
except:
return False