问题描述
我正在制作一个简单的程序,该程序使用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 (将#修改为@)