本文整理汇总了Python中tkinter.filedialog.askdirectory方法的典型用法代码示例。如果您正苦于以下问题:Python filedialog.askdirectory方法的具体用法?Python filedialog.askdirectory怎么用?Python filedialog.askdirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.filedialog
的用法示例。
在下文中一共展示了filedialog.askdirectory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: choose_folder
# 需要导入模块: from tkinter import filedialog [as 别名]
# 或者: from tkinter.filedialog import askdirectory [as 别名]
def choose_folder(project_name):
global current_video, projectini
projectini = project_name
img_dir = filedialog.askdirectory()
os.chdir(img_dir)
dirpath = os.path.basename(os.getcwd())
current_video = dirpath
print('Current Video: ' + current_video)
global frames_in
frames_in = []
for i in os.listdir(os.curdir):
if i.__contains__(".png"):
frames_in.append(i)
reset()
frames_in = sorted(frames_in, key=lambda x: int(x.split('.')[0]))
# print(frames_in)
number_of_frames = len(frames_in)
print("Number of Frames: " + str(number_of_frames))
configure(project_name)
MainInterface()
#create_data_frame(number_of_frames)
开发者ID:sgoldenlab,项目名称:simba,代码行数:27,代码来源:labelling_aggression.py
示例2: select_destination
# 需要导入模块: from tkinter import filedialog [as 别名]
# 或者: from tkinter.filedialog import askdirectory [as 别名]
def select_destination(self):
"""
Check if the destination path is in the command line arguments,
if not ask user for input using filedialog.
If the destination path in arguments does not exist create it.
:return: str. Destination folder path.
"""
if self.args.dstcwd:
destination = os.getcwd()
else:
if self.args.dest is None:
print("Choose a destination path.")
destination = os.path.normpath(askdirectory())
print(f"Destination path: {destination}")
else:
destination = self.args.dest
if not os.path.exists(destination):
os.makedirs(destination)
return destination
开发者ID:pltnk,项目名称:selective_copy,代码行数:21,代码来源:process.py
示例3: browse_directory
# 需要导入模块: from tkinter import filedialog [as 别名]
# 或者: from tkinter.filedialog import askdirectory [as 别名]
def browse_directory(self, option):
if option == "pcap":
# Reference: http://effbot.org/tkinterbook/tkinter-dialog-windows.htm
self.pcap_file.set(fd.askopenfilename(initialdir = sys.path[0],title = "Select Packet Capture File!",filetypes = (("All","*.pcap *.pcapng"),("pcap files","*.pcap"),("pcapng files","*.pcapng"))))
self.filename = self.pcap_file.get().replace(".pcap","")
if "/" in self.filename:
self.filename = self.filename.split("/")[-1]
#,("all files","*.*")
#self.filename_field.delete(0, END)
#self.filename_field.insert(0, self.pcap_file)
print(self.filename)
print(self.pcap_file)
else:
self.destination_report.set(fd.askdirectory())
if self.destination_report.get():
if not os.access(self.destination_report.get(), os.W_OK):
mb.showerror("Error","Permission denied to create report! Run with higher privilege.")
else:
mb.showerror("Error", "Enter a output directory!")
开发者ID:Srinivas11789,项目名称:PcapXray,代码行数:21,代码来源:user_interface.py
示例4: choose_directory
# 需要导入模块: from tkinter import filedialog [as 别名]
# 或者: from tkinter.filedialog import askdirectory [as 别名]
def choose_directory():
directory_root = Tk()
directory_root.withdraw()
path_work = filedialog.askdirectory()
if path_work == '':
print('你没有选择目录! 请重新选:')
sleep(2)
return choose_directory()
else:
# askdirectory 获得是 正斜杠 路径C:/,所以下面要把 / 换成 反斜杠\
return path_work.replace('/', sep)
# 功能:检查 归类根目录 的合法性
# 参数:用户自定义的归类根目录,用户选择整理的文件夹路径
# 返回:归类根目录路径
# 辅助:os.sep,os.system
开发者ID:junerain123,项目名称:javsdt,代码行数:19,代码来源:functions_preparation.py
示例5: select_folder
# 需要导入模块: from tkinter import filedialog [as 别名]
# 或者: from tkinter.filedialog import askdirectory [as 别名]
def select_folder(title="Select folder", folder=".", master=None):
"""
Display a box to select a folder.
If a folder is selected the folder path is returned, otherwise `None` is returned.
:param string title:
The title to be displayed on the box. Defaults to 'Select file'.
:param string folder:
The initial folder to open. Defaults to '.'.
:param App master:
Optional guizero master which the popup will be placed over. Defaults
to `None`.
:return:
The path of folder selected or `None`.
"""
if not os.path.isdir(folder):
utils.error_format("The folder '{}' specified for select_folder does not exist.".format(folder))
folder = "."
return filedialog.askdirectory(title=title, initialdir=folder, parent=None if master is None else master.tk)
开发者ID:lawsie,项目名称:guizero,代码行数:23,代码来源:dialog.py
示例6: select_source
# 需要导入模块: from tkinter import filedialog [as 别名]
# 或者: from tkinter.filedialog import askdirectory [as 别名]
def select_source(self):
"""
Check if the source path is in the command line arguments,
if not ask user for input using filedialog.
:return: str. Source folder path.
"""
if self.args.srccwd:
source = os.getcwd()
else:
if self.args.source is None:
print("Choose a source path.")
source = os.path.normpath(askdirectory())
print(f"Source path: {source}")
else:
source = self.args.source
return source
开发者ID:pltnk,项目名称:selective_copy,代码行数:18,代码来源:process.py
示例7: openfile
# 需要导入模块: from tkinter import filedialog [as 别名]
# 或者: from tkinter.filedialog import askdirectory [as 别名]
def openfile(self, event):
if event.widget["text"] == "..":
intput_type = self.input_type.get()
if not intput_type:
messagebox.showerror("Error", "please select the input type first.")
return
if intput_type == "video":
self.input_filename = askopenfilenames(title='select', filetypes=[
("all video format", ".mp4"),
("all video format", ".flv"),
("all video format", ".avi"),
])
elif intput_type == "image":
self.input_filename = askopenfilenames(title='select', filetypes=[
("image", ".jpeg"),
("image", ".png"),
("image", ".jpg"),
])
self.label0_["text"] = self.input_filename
elif event.widget["text"] == "...":
self.output_dir = askdirectory(title="select")
self.label1_["text"] = self.output_dir
开发者ID:MashiMaroLjc,项目名称:rabbitVE,代码行数:24,代码来源:extract_face_view.py
示例8: browse_button
# 需要导入模块: from tkinter import filedialog [as 别名]
# 或者: from tkinter.filedialog import askdirectory [as 别名]
def browse_button():
# Allow user to select a directory and store it in global var
# called folder_path
global folder_path
filename = filedialog.askdirectory()
folder_path.set(filename)
print(filename)
开发者ID:rpotter12,项目名称:spotify-downloader-music-player,代码行数:9,代码来源:test.py
示例9: choose_file
# 需要导入模块: from tkinter import filedialog [as 别名]
# 或者: from tkinter.filedialog import askdirectory [as 别名]
def choose_file(self):
path = filedialog.askdirectory(
title="选择下载文件夹",
)
if not path:
return
path = Path(path)
self.label_text.set(str(path))
if self._config is not None:
self._config.op_store_path(self._store_name, path)
开发者ID:winkidney,项目名称:PickTrue,代码行数:12,代码来源:toolkit.py
示例10: choose_location
# 需要导入模块: from tkinter import filedialog [as 别名]
# 或者: from tkinter.filedialog import askdirectory [as 别名]
def choose_location(self):
"""
Shows a popup window to select a directory to choose save the lists generated. then sends the path to
the main view.
:author: Pablo Sanz Algucil
"""
path = filedialog.askdirectory(title="Choose directory",
initialdir="/home",
mustexist=True)
self.files_location = path
self.main_view.get_notify_childs(4, self.files_location)
开发者ID:pabloibiza,项目名称:WiCC,代码行数:15,代码来源:wicc_view_wordlist.py
示例11: __select_excel_output
# 需要导入模块: from tkinter import filedialog [as 别名]
# 或者: from tkinter.filedialog import askdirectory [as 别名]
def __select_excel_output(self, entry_box):
path = askdirectory()
entry_box.delete(0, len(entry_box.get()))
entry_box.insert(0, path)
return path
开发者ID:liucaide,项目名称:Andromeda,代码行数:7,代码来源:ui_input.py
示例12: select_dir
# 需要导入模块: from tkinter import filedialog [as 别名]
# 或者: from tkinter.filedialog import askdirectory [as 别名]
def select_dir():
global DIRS
DIRS = filedialog.askdirectory() # 获得文件夹地址
开发者ID:jtyoui,项目名称:Jtyoui,代码行数:5,代码来源:tk.py
示例13: load_folder
# 需要导入模块: from tkinter import filedialog [as 别名]
# 或者: from tkinter.filedialog import askdirectory [as 别名]
def load_folder(project_name):
global current_video
img_dir = filedialog.askdirectory()
os.chdir(img_dir)
print("Working directory is %s" % os.getcwd())
dirpath = os.path.basename(os.getcwd())
current_video = dirpath
print('Current Video: ' + current_video)
## get the frames
global frames_in
frames_in = []
for i in os.listdir(os.curdir):
if i.__contains__(".png"):
frames_in.append(i)
reset()
frames_in = sorted(frames_in, key=lambda x: int(x.split('.')[0]))
# print(frames_in)
number_of_frames = len(frames_in)
print("Number of Frames: " + str(number_of_frames))
configure(project_name)
curr_target_csv= os.path.join(os.path.dirname(project_name),'csv','targets_inserted',os.path.basename(img_dir)+'.csv')
df = pd.read_csv(curr_target_csv)
df = df.fillna(0)
print(df)
MainInterface()
#create_data_frame(number_of_frames)
开发者ID:sgoldenlab,项目名称:simba,代码行数:30,代码来源:load_labelling_aggression_hxt.py
示例14: dec_path
# 需要导入模块: from tkinter import filedialog [as 别名]
# 或者: from tkinter.filedialog import askdirectory [as 别名]
def dec_path():
path = askdirectory(title = 'Select directory with files to decrypt')
if path == None or path == '':
messagebox.showwarning('Error', 'No path selected, exiting...')
return False
path = path + '/'
return path
开发者ID:leonv024,项目名称:RAASNet,代码行数:9,代码来源:decrypt.py
示例15: __init__
# 需要导入模块: from tkinter import filedialog [as 别名]
# 或者: from tkinter.filedialog import askdirectory [as 别名]
def __init__(self, initialdir, file_type):
if file_type == 'dir':
self.choice = filedialog.askdirectory(initialdir=initialdir)
开发者ID:TristenHarr,项目名称:MyPyBuilder,代码行数:5,代码来源:FileDialogClass.py
注:本文中的tkinter.filedialog.askdirectory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。
评论