如何解决使用进度条复制文件?
我正在制作一个简单的程序,该程序使用tkinter和shutil来复制文件,没什么花哨的。问题在于,没有迹象表明该过程何时完成,如果我要复制大文件夹,该程序将冻结直到完成复制。我想要一个进度条,但不知道如何在tkinter中实现它。
from tkinter import *
from tkinter import filedialog
import shutil
def browseFiles():
filename = filedialog.askdirectory(initialdir="/",title="Select a directory")
label_file_explorer.configure(text="Directory Opened: " + filename,bg="grey")
shutil.copytree(filename,r"J:\PCmover\ziptest\test")
window = Tk()
window.title('Beringia')
window.geometry("700x500")
window.config(background="white")
label_file_explorer = Label(window,width=100,height=4,bg="white",fg="blue")
button_explore = Button(window,text="Choose directory",command=browseFiles)
button_exit = Button(window,text="Quit",command=exit)
softwarename=Label(window,text="Welcome to Beringia!",fg="blue")
ver=Label(window,text="Ver 1.0",bg="grey",fg="blue")
label_file_explorer.place(x=0,y=200)
button_explore.place(x=305,y=80)
button_exit.place(x=335,y=120)
softwarename.place(x=0,y=0)
ver.place(x=659,y=479)
window.mainloop()
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。