本文整理汇总了Python中tkinter.filedialog.askdirectory函数的典型用法代码示例。如果您正苦于以下问题:Python askdirectory函数的具体用法?Python askdirectory怎么用?Python askdirectory使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了askdirectory函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: add_folder_pair
def add_folder_pair(self):
folder1 = filedialog.askdirectory()
folder2 = filedialog.askdirectory()
self.listbox1.insert(END ,folder1)
self.listbox2.insert(END, folder2)
self.root.update()
self.folders.append([folder1, folder2])
开发者ID:keyvin,项目名称:savesync,代码行数:7,代码来源:gui.py
示例2: proceso
def proceso():
ent = filedialog.askdirectory() # directorio entrada
ini = int(inicio.get())
pas = int(paso.get())
fin = int(final.get())
guar = nombre.get()
sali = filedialog.askdirectory() #directorio salida
rango = range(ini,fin + pas,pas)
arc = open(str(sali)+"/"+str(guar),"w")
for i in rango:
data = open(str(ent)+"/defo."+str(i),"r")
linea = data.readlines()
con = 0
for j, line in enumerate(linea):
if j > 9:
spl = line.split()
if float(spl[6]) < 3.5:
con = con + 1
else:
continue
arc.write(str(i)+" ")
arc.write(str(con))
arc.write("\n")
data.close()
arc.close()
开发者ID:shigueru,项目名称:nano,代码行数:31,代码来源:disloca_gui.py
示例3: openFolderDialog
def openFolderDialog(self, buttonName):
global sourceDir, destinationDir, ipAddress, user
root = tk.Tk()
root.withdraw()
rootFolder = repr(os.getcwd())
rootFolder = rootFolder.replace("\\\\", "\\").replace("'", '')
rootFolder += '\Folder_Structure'
if (buttonName == 'source'):
temp = sourceDir
sourceDir = tkfd.askdirectory(parent=root,initialdir="/",title='Please select the source directory')
if (sourceDir == ''):
sourceDir = temp
elif (buttonName == 'destination'):
temp = destinationDir
destinationDir = 'a'
# Download the folder structure from the server
#try:
cmd = 'rsync -a -v -z -ssh --delete --delete-excluded ' + '-f"+ */" -f"- *" ' + user + '@' + ipAddress + ':Data/ ' + sync.convertPathToCygdrive(rootFolder)
print (cmd)
#TODO insert
proc = subprocess.Popen(cmd,
shell=True,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
)
remainder = str(proc.communicate()[0])
ibis = remainder.replace('\\n', '\n')
#print(remainder)
print(ibis)
# output = ''
# while not 'password' in output:
# output = proc.stdout.readline()
# print(output)
# proc.stdin.write('ibiscp')
#except:
# self.showMessage(3, QtGui.QSystemTrayIcon.Warning, 'Folder structure could not update!')
while (not rootFolder in destinationDir) and (destinationDir != ''):
destinationDir = tkfd.askdirectory(parent=root,initialdir=rootFolder,title='Please select the destination directory inside the folder: ' + rootFolder)
destinationDir = destinationDir.replace("/", "\\")
if (destinationDir == ''):
destinationDir = temp
# Change the folder path to server path
destinationDir = 'Server/' + destinationDir[(len(rootFolder)+1):]
self.setText()
self.enableAddButton()
开发者ID:ibiscp,项目名称:Ibis_Cloud,代码行数:57,代码来源:start.py
示例4: proceso
def proceso():
v = filedialog.askdirectory()
ini = inicio.get()
pa = paso.get()
fi = final.get()
nom = nombre.get()
o = filedialog.askdirectory()
cmd = "ovitos strucs_argv.py %s %s %s %s %s %s"%(ini,pa,fi,nom,v,o)
os.system(cmd)
开发者ID:shigueru,项目名称:nano,代码行数:9,代码来源:strucs_gui.py
示例5: loadFramesByDirectory
def loadFramesByDirectory(self):
if self.debug_FLAG:
if self.db == 'salsa':
self.dname = "Data\\Salsa\\Videos\\" + self.debug_fastaccess + "_kinect_1"
elif self.db == 'calus':
self.dname = "Data\\Calus\\frames"
else:
if self.db == 'salsa':
self.dname = askdirectory(initialdir='Data\\Salsa\\Videos')
elif self.db == 'calus':
self.dname = askdirectory(initialdir='Data\\Calus')
if self.dname:
try:
self.entry_name_frames.insert(0,"..." + self.dname[-30:])
self.indexFrames = []
for file in os.listdir(self.dname):
dum, self.checkvideof_ext = os.path.splitext(file)
if self.checkvideof_ext in ('.jpeg', '.JPG', '.JPEG', '.png', '.bmp', '.PNG', '.BMP'):
dum, self.videof_ext = os.path.splitext(file)
k = file.rfind("_")
l = file.rfind(".")
iFrame = file[k+1:l]
if iFrame[0] == 'f':
iFrame = iFrame[1:]
self.indexFrames.append(int(iFrame))
self.prefixname = file[:k+2]
else:
self.indexFrames.append(int(iFrame))
self.prefixname = file[:k+1]
self.indexFrames = sorted(self.indexFrames)
self.videoStatusSTR.set( str(len(self.indexFrames)) + " Frames" )
self.videoLoadedFlag = True
elif file in ('Thumbs.db'):
continue
else:
showerror("Fail", "Only jpeg, jpg, JPG, bmp, BMP, png, PNG frames are supported")
self.videoLoadedFlag = False
return
self.checkContinueEnable()
except Exception as e: # <- naked except is a bad idea
self.videoLoadedFlag = False
self.checkContinueEnable()
showerror("Error", ("Open Source File\n'%s'" % e) + "\n" + ("Failed to open directory\n'%s'" % self.dname))
return
return
开发者ID:MKLab-ITI,项目名称:DanceAnno,代码行数:57,代码来源:DanceAnno_Loader.py
示例6: confirm_name
def confirm_name(info_lines, line_num, filetypes, title):
"""GUI asks user to choose a file/directory if the existing cannot be found"""
# set initial variables, if filetypes is blank, then a directory is wanted
path = info_lines[line_num - 1].rstrip('\r\n')
directory = filetypes is None
# if the path does not exist, prompt for a new one
if not os.path.exists(path):
if DEBUG:
print("path " + str(path) + " does not exist")
Tk().withdraw()
if directory:
path = askdirectory(title = title)
else:
path = askopenfilename(filetypes = filetypes, title = title)
# throw SystemExit exception if the user does not choose a valid path
if not os.path.exists(path):
sys.exit()
# save the new path to the array if the user chooses a valid path
else:
if DEBUG:
print(str(info_lines[line_num - 1]).rstrip('\r\n') +
" will be changed to " + str(path))
info_lines[line_num - 1] = path + "\n"
elif DEBUG:
print(str(path) + " exists")
return path
开发者ID:karepker,项目名称:pyTunes-Export,代码行数:31,代码来源:pyTunes_Export.py
示例7: folder_dlg
def folder_dlg(self):
foldername = filedialog.askdirectory()
if foldername:
foldername = self._fix_paths_on_windows(foldername)
self.foldername = foldername
self.most_recent = 'folder'
self.update_label()
开发者ID:jjcodes,项目名称:hematuria_spots,代码行数:7,代码来源:HematuriaDetectorGUI.py
示例8: gui_inputs
def gui_inputs():
"""create gui interface and return the required inputs
Returns
-------
infile : str
pathname to the shapefile to apply the split
field : str
name of the field in the shape file
dest : str
folder name to save the outputs
"""
# locate your input shapefile
print("select your input file")
root = Tk()
infile = tkfd.askopenfilename(title = "Select your shapefile",
initialdir = "C:/",
filetypes = (("shapefile", "*.shp"),
("all files", "*.*")))
# define destination -folder- where output -shapefiles- will be written
print("select your output dir")
dest = tkfd.askdirectory(title = "Select your output folder",
initialdir = "C:/")
root.destroy()
# choose field to split by attributes
print("Select your field name")
field_options = _extract_attribute_field_names(infile)
field = create_field_form(field_options)
print("selection done")
return infile, field, dest
开发者ID:inbo,项目名称:python-snippets,代码行数:33,代码来源:split_shapefile_by_attributes.py
示例9: askDirectory
def askDirectory(self):
optionsd = {}
optionsd['initialdir'] = 'C:\\'
optionsd['mustexist'] = False
optionsd['parent'] = self.root
optionsd['title'] = 'This is a title'
return self.loadAll(filedialog.askdirectory(**optionsd))
开发者ID:maxter2323,项目名称:Python-Small-Examples,代码行数:7,代码来源:wallpaperGalleryForWin.py
示例10: gogo
def gogo(entries):
# name = (entries['Session Name'].get())
epsilon = (int(entries['Epsilon'].get()))
min_neighbors = (int(entries['Minimum Neighbors'].get()))
mini_epsilon = (int(entries['Mini Epsilon'].get()))
mini_min_neighbors = (int(entries['Mini Minimum Neighbors'].get()))
prot_mode = 2 if entries['Mode'].get() == "2 protein" else 1
d_type = (entries['Data Type'].get())
path = filedialog.askdirectory()
f_color = (entries['color'].get())
f_points = (entries['#points'].get())
f_red_points = (entries['#red points'].get())
f_green_points = (entries['#green points'].get())
f_density = (entries['density'].get())
f_coloc = (entries['colocalized'].get())
f_x_angle = (entries['angle x'].get())
f_y_angle = (entries['angle y'].get())
f_size = (entries['size'].get())
print(path)
messagebox.showinfo("Work in progress",
"Please wait till' it's done... You'll get a message (for now just click OK).")
go(epsilon, min_neighbors, mini_epsilon, mini_min_neighbors, d_type, path, prot_mode, f_color, f_points, f_red_points,
f_green_points, f_density, f_coloc, f_x_angle, f_y_angle, f_size)
messagebox.showinfo("Work is DONE!", "You may now enter another session folder.")
开发者ID:tinCanBear,项目名称:Retsulc,代码行数:26,代码来源:main_with_gui.py
示例11: browseToFolder
def browseToFolder(self):
"""Opens a windows file browser to allow user to navigate to the directory to read
returns the file name of the path that was selected
"""
retFileName = filedialog.askdirectory()
print ("Selected Folder: ",retFileName)
return retFileName
开发者ID:douggilliland,项目名称:lb-Python-Code,代码行数:7,代码来源:pyDirCSV.py
示例12: setloc
def setloc(self):
if self.type=='dir':
self.loc.set(askdirectory())
elif self.type=='file':
self.loc.set(askopenfilename())
else:
self.loc.set(None)
开发者ID:KhalidEzzeldeen,项目名称:BitsAndBobs,代码行数:7,代码来源:fileformrows.py
示例13: onSourceButton
def onSourceButton(self):
# stop any on going analysis thread
if (self.mAnalyzeThread) and self.mAnalyzeThread.is_alive():
print("stopping thread")
self.mStopThreadRequest = True
self.mAnalyzeThread.join(1.)
# reset the source and destination lists
self.uiSourceList.delete(0, END)
self.uiDestinationList.delete(0, END)
#query user for a new source folder
folder = filedialog.askdirectory(title=self.T['SRC_cb_dlg'],
mustexist=True,
initialdir=self.mSourceFolder
)
self.uiSourceValue.set(folder)
self.mSourceFolder = folder
self.Log("%s: <%s>\n" % (self.T['SRC_cb_log'], self.uiSourceValue.get()))
# start the source parsing thread
self.mStopThreadRequest = False
self.mAnalyzeThread = threading.Thread(target=self.AnalyzeWorkerThread)
self.mAnalyzeThread.start()
开发者ID:JMVOLLE,项目名称:SortImages,代码行数:27,代码来源:sort_images.py
示例14: file_handler
def file_handler():
'''Prompt the user for the folder path, and read all the files with it.'''
#location = input('Please indicate whether right or left you want to label (r, l): ').lower()
directory = filedialog.askdirectory()
file_list = os.listdir(directory)
os.chdir(directory)
newfolderpath = directory + '/labeled'
if not os.path.exists(newfolderpath):
os.mkdir(newfolderpath)
for each in file_list:
img = cv2.imread(each)
#x=60
#y=60
x = int(img.shape[0]/30)
y = int(img.shape[1]/30)
#print (x1,y1)
os.chdir(newfolderpath)
font = cv2.FONT_HERSHEY_SCRIPT_SIMPLEX
labeled = cv2.putText(img,'[email protected]',(x,y-5), font , 1.8, (0,0,0),5)
labeled = cv2.putText(img,'[email protected]',(x,y), font , 1.8, (255,255,255),6)
labeled = cv2.putText(img,'[email protected]',(x,y+5), font , 1.8, (0,0,0),4)
#labeled = cv2.putText(img,'[email protected]',(x,y+8), font , 1.5, (255,255,255),2)
newfile = 'l-'+each
if os.path.exists(newfolderpath+'/'+newfile):
os.remove(newfile)
cv2.imwrite(newfile, labeled)
os.chdir(directory)
开发者ID:zinph,项目名称:photo-labeling,代码行数:27,代码来源:ArthuziLabel.py
示例15: SelectDataFiles
def SelectDataFiles():
"""Select the files to compress into a JAM"""
# Draw (then withdraw) the root Tk window
logging.info("Drawing root Tk window")
root = Tk()
logging.info("Withdrawing root Tk window")
root.withdraw()
# Overwrite root display settings
logging.info("Overwrite root settings to basically hide it")
root.overrideredirect(True)
root.geometry('0x0+0+0')
# Show window again, lift it so it can recieve the focus
# Otherwise, it is behind the console window
root.deiconify()
root.lift()
root.focus_force()
# The files to be compressed
jam_files = filedialog.askdirectory(
parent=root,
title="Where are the extracted LEGO.JAM files located?"
)
if not jam_files:
root.destroy()
colors.text("\nCould not find a JAM archive to compress!",
color.FG_LIGHT_RED)
main()
# Compress the JAM
root.destroy()
BuildJAM(jam_files)
开发者ID:le717,项目名称:PatchIt,代码行数:34,代码来源:legojam.py
示例16: update_files
def update_files(self):
"""Update the Calendar with the new files"""
self.clear_data_widgets()
self._dates.clear()
folder = variables.settings["parsing"]["path"]
if not os.path.exists(folder):
messagebox.showerror("Error",
"The specified CombatLogs folder does not exist. Please "
"choose a different folder.")
folder = filedialog.askdirectory()
variables.settings.write_settings({"parsing": {"path": folder}})
return self.update_files()
files = [f for f in os.listdir(folder) if Parser.get_gsf_in_file(f)]
self.create_splash(len(files))
match_count: Dict[datetime: int] = DateKeyDict()
for file in files:
date = Parser.parse_filename(file)
if date is None: # Failed to parse
continue
if date not in match_count:
match_count[date] = 0
match_count[date] += Parser.count_matches(file)
if date not in self._dates:
self._dates[date] = list()
self._dates[date].append(file)
self._splash.increment()
self._calendar.update_heatmap(match_count)
self.destroy_splash()
开发者ID:RedFantom,项目名称:GSF-Parser-Public,代码行数:28,代码来源:file.py
示例17: getFile
def getFile(self):
fn = askdirectory()
self.fileName.configure(state='normal')
self.fileName.delete(0, tk.END)
self.fileName.insert(0, fn)
self.fileName.configure(state='disabled')
self.directory = fn
开发者ID:SinisterSoda,项目名称:Audverter,代码行数:7,代码来源:GUI.py
示例18: openDir
def openDir(dir):
global inDir
inDir = askdirectory()
print(inDir)
dir.delete(0,END)
dir.insert(0,inDir)
return(inDir)
开发者ID:janinamass,项目名称:gardening,代码行数:7,代码来源:wizard.py
示例19: _handle_hashdb_directory_chooser
def _handle_hashdb_directory_chooser(self, *args):
hashdb_directory = fd.askdirectory(
title="Open hashdb Database Directory",
mustexist=True)
if hashdb_directory:
self._hashdb_directory_entry.delete(0, tkinter.END)
self._hashdb_directory_entry.insert(0, hashdb_directory)
开发者ID:NPS-DEEP,项目名称:NPS-SectorScope,代码行数:7,代码来源:scan_media_window.py
示例20: openOutDir
def openOutDir(dir):
global outDir
outDir = askdirectory()
print(outDir)
dir.delete(0,END)
dir.insert(0,outDir)
return(outDir)
开发者ID:janinamass,项目名称:gardening,代码行数:7,代码来源:wizard.py
注:本文中的tkinter.filedialog.askdirectory函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论