2016-09-15 4 views
0

일부 파일을 복사하기 위해 작은 응용 프로그램을 쓰고 있습니다. 나는 거의 모든 것을 만들었지 만 3 가지 :tkinter의 진행 표시 줄이 작동하지 않습니다.

1) 복사 옵션이 움직이는 동안 진행할 진행률 막대. 나는 그것을 표시 할 수 있지만 반응하지 않을 것이다.

나는 그것을 표시하려면이을 사용하고 있습니다 :

self.p = ttk.Progressbar(self, orient=HORIZONTAL, length=300, mode='indeterminate') 
self.p.grid(row=5) 

를 후 버튼의 보도에라는 또 다른 데프을 시작합니다 :

self.p.start() 

shutil.copytree(self.source_direcotry0, self.cam0) 
shutil.copytree(self.source_direcotry1, self.cam1) 
shutil.copytree(self.source_direcotry2, self.cam2) 

self.p.stop() 

불행하게도 복사가 발생했지만 막대가 전혀 움직이지 않습니다.

self.status = Label(self.master, text="Waiting for process to start...", bd=1, relief=SUNKEN, anchor=W) 
self.status.pack(side=BOTTOM, fill=X) 

그리고 같은 복사 데프는 그것의 시작 부분에 호출 될 때 나는이 있습니다

2) 두 번째 문제는 응용 프로그램 창 하단에 표시하고있는 정보 표시 줄에 연결되어 :

self.status['text'] = "Files are being copyied, have patience ;)".format(self.status) 

그리고 상태가 나는 또한 상태를 변경하는 동일한 명령이이 데프의 끝으로 이상한 인 변경되지 않습니다이 하나가 작동합니다

self.status['text'] = "Files have been copyied".format(self.status) 

3) 사진을 첨부 할 수없는 것 같습니다. 모든 옵션을 선택했는데 아무 것도 작동하지 않는 것 같습니다. 여기에 표시된 사진은 무언가를 표시하려고 시도하는 것처럼 보이지만 (사진이 커짐) 사진 표시되지 않은 :

self.img = ImageTk.PhotoImage(Image.open("az.png")) 
self.panel = Label(self, image=self.img, bg="#E6E6E6") 
self.display = self.img 
self.panel.grid(row=8) 

나는 단지의 경우도 내가 여기에 전체 코드를 게시하고 더 많은 정보를 원하시면, 그런 일이 왜 조금 확실하지 오전 :

from tkinter import * 
from tkinter import ttk 
import re 
from tkinter import messagebox 
from tkinter import filedialog 
import ntpath 
import os 
import shutil 
import tkinter.filedialog as fdialog 
from send2trash import send2trash 
from PIL import Image, ImageTk 

#os.system('''/usr/bin/osascript -e 'tell app "Finder" to set frontmost of process "Python" to true' ''') 


# Here, we are creating our class, Window, and inheriting from the Frame 
# class. Frame is a class from the tkinter module. (see Lib/tkinter/__init__) 

class Window(Frame): 

    # Define settings upon initialization. Here you can specify 
    def __init__(self, master=None): 

     # parameters that you want to send through the Frame class. 
     Frame.__init__(self, master, bg="#E6E6E6") 

     #reference to the master widget, which is the tk window     
     self.master = master 

     #with that, we want to then run init_window, which doesn't yet exist 
     self.init_window() 

    def copyy(self): 

     self.status['text'] = "Files are being copyied, have patience ;)".format(self.status) 


     self.source_direcotry0= '/Volumes/CAM0/DCIM/100HDDVR' 
     self.source_direcotry1= '/Volumes/CAM1/DCIM/100HDDVR' 
     self.source_direcotry2= '/Volumes/CAM2/DCIM/100HDDVR' 
     self.source_direcotry3= '/Volumes/CAM3/DCIM/100HDDVR' 
     self.source_direcotry4= '/Volumes/CAM4/DCIM/100HDDVR' 
     self.source_direcotry5= '/Volumes/CAM5/DCIM/100HDDVR' 
     self.source_direcotry6= '/Volumes/CAM6/DCIM/100HDDVR' 
     self.source_direcotry7= '/Volumes/CAM7/DCIM/100HDDVR' 
     self.source_direcotry8= '/Volumes/CAM8/DCIM/100HDDVR' 
     self.source_direcotry9= '/Volumes/CAM9/DCIM/100HDDVR' 
     self.source_direcotry10= '/Volumes/CAM10/DCIM/100HDDVR' 
     self.source_direcotry11= '/Volumes/CAM11/DCIM/100HDDVR' 

     self.path0="recording/CAM0" 
     self.path1="recording/CAM1" 
     self.path2="recording/CAM2" 
     self.path3="recording/CAM3" 
     self.path4="recording/CAM4" 
     self.path5="recording/CAM5" 
     self.path6="recording/CAM6" 
     self.path7="recording/CAM7" 
     self.path8="recording/CAM8" 
     self.path9="recording/CAM9" 
     self.path10="recording/CAM10" 
     self.path11="recording/CAM11" 

     self.cam0=os.path.join(self.Destination.get(), self.path0) 
     self.cam1=os.path.join(self.Destination.get(), self.path1) 
     self.cam2=os.path.join(self.Destination.get(), self.path2) 
     self.cam3=os.path.join(self.Destination.get(), self.path3) 
     self.cam4=os.path.join(self.Destination.get(), self.path4) 
     self.cam5=os.path.join(self.Destination.get(), self.path5) 
     self.cam6=os.path.join(self.Destination.get(), self.path6) 
     self.cam7=os.path.join(self.Destination.get(), self.path7) 
     self.cam8=os.path.join(self.Destination.get(), self.path8) 
     self.cam9=os.path.join(self.Destination.get(), self.path9) 
     self.cam10=os.path.join(self.Destination.get(), self.path10) 
     self.cam11=os.path.join(self.Destination.get(), self.path11) 

     self.p.start() 

     shutil.copytree(self.source_direcotry0, self.cam0) 
     shutil.copytree(self.source_direcotry1, self.cam1) 
     shutil.copytree(self.source_direcotry2, self.cam2) 
     # shutil.copytree(self.source_direcotry3, self.cam3) 
     # shutil.copytree(self.source_direcotry4, self.cam4) 
     # shutil.copytree(self.source_direcotry5, self.cam5) 
     # shutil.copytree(self.source_direcotry6, self.cam6) 
     # shutil.copytree(self.source_direcotry7, self.cam7) 
     # shutil.copytree(self.source_direcotry8, self.cam8) 
     # shutil.copytree(self.source_direcotry9, self.cam9) 
     # shutil.copytree(self.source_direcotry10, self.cam10) 
     # shutil.copytree(self.source_direcotry11, self.cam11) 

     self.p.stop() 

     self.status['text'] = "Files have been copyied".format(self.status) 

    def deletee(self): 
     send2trash('/Volumes/CAM0/DCIM') 
     send2trash('/Volumes/CAM1/DCIM') 
     send2trash('/Volumes/CAM2/DCIM') 
     # send2trash('/Volumes/CAM3/DCIM') 
     # send2trash('/Volumes/CAM4/DCIM') 
     # send2trash('/Volumes/CAM5/DCIM') 
     # send2trash('/Volumes/CAM6/DCIM') 
     # send2trash('/Volumes/CAM7/DCIM') 
     # send2trash('/Volumes/CAM8/DCIM') 
     # send2trash('/Volumes/CAM9/DCIM') 
     # send2trash('/Volumes/CAM10/DCIM') 
     # send2trash('/Volumes/CAM11/DCIM') 

     self.status['text'] = "Files have been moved to trash".format(self.status) 


    def client_exit(self): 
     exit() 

    def about_popup(self): 
     messagebox.showinfo("About", "This is software used to copy or delete files in bulk from the Absolute Zero VR camera") 


    #Creation of init_window 
    def init_window(self): 

     self.Source=StringVar() 
     self.Destination=StringVar() 


     # changing the title of our master widget  
     self.master.title("AZ Data Extractor") 

     # allowing the widget to take the full space of the root window 
     self.pack(fill=BOTH, expand=1) 

     #Creating the menu 
     self.menubar = Menu(self.master) 

     #Creating submenues 
     self.filemenu = Menu(self.menubar, tearoff=0) 
     self.filemenu.add_command(label="Exit", command=root.quit) 
     self.menubar.add_cascade(label="File", menu=self.filemenu) 

     self.helpmenu = Menu(self.menubar, tearoff=0) 
     self.helpmenu.add_command(label="About", command=self.about_popup) 
     self.menubar.add_cascade(label="Help", menu=self.helpmenu) 

     #Displaying the menu 
     root.config(menu=self.menubar) 

     #Creating the intro label 
     l_instruction = Label(self, justify=CENTER, compound=TOP, text="Choose the destination for the copied files \n and press 'Go!' to start copyting", bg="#E6E6E6") 
     l_instruction.grid(columnspan=2, ipady=10) 

     l_instruction = Label(self, justify=CENTER, compound=TOP, text="Press 'Delete' to move all files \n from the camera to the trash", bg="#E6E6E6") 
     l_instruction.grid(row=6, columnspan=2, ipady=10) 

     # ttk.Style().configure('green/black.TButton', foreground='green', background='black') 
     #Creating the button 
     MyDestination=Entry(self, textvariable=self.Destination, bg="#E6E6E6") 
     MyDestination.grid(row=2, columnspan=2, ipady=10) 
     uploadButton = Button(self, text="Choose destination folder",command=lambda:self.Destination.set(fdialog.askdirectory())) 
     uploadButton.grid(row=3, columnspan=2, ipady=10) 
     goButton = Button(self, text="Go!",command=self.copyy) 
     goButton.grid(row=4, columnspan=2, ipady=10) 
     delButton = Button(self, text="Delete",command=self.deletee) 
     delButton.grid(row=7, columnspan=2, ipady=10) 

     self.p = ttk.Progressbar(self, orient=HORIZONTAL, length=300, mode='indeterminate') 
     self.p.grid(row=5) 

     self.img = ImageTk.PhotoImage(Image.open("az.png")) 
     self.panel = Label(self, image=self.img, bg="#E6E6E6") 
     self.display = self.img 
     self.panel.grid(row=8) 


     #resizing configuration 
     self.grid_columnconfigure(0,weight=1) 
     self.grid_columnconfigure(1,weight=1) 
     self.grid_rowconfigure(0,weight=1) 
     self.grid_rowconfigure(1,weight=1) 
     self.grid_rowconfigure(2,weight=1) 
     self.grid_rowconfigure(3,weight=1) 
     self.grid_rowconfigure(4,weight=1) 
     self.grid_rowconfigure(5,weight=1) 
     self.grid_rowconfigure(6,weight=1) 
     self.grid_rowconfigure(7,weight=1) 
     self.grid_rowconfigure(8,weight=1) 
     self.grid_rowconfigure(9,weight=1) 
     self.grid_rowconfigure(10,weight=1) 

     #status Bar 
     self.status = Label(self.master, text="Waiting for process to start...", bd=1, relief=SUNKEN, anchor=W) 
     self.status.pack(side=BOTTOM, fill=X) 


# root window created. Here, that would be the only window, but you can later have windows within windows. 
root = Tk() 
root.resizable(width=False,height=False); 
# root.configure(background='black'); 
# fm = Frame(root, width=300, height=200, bg="blue") 
# fm.pack(side=TOP, expand=NO, fill=NONE) 
#root.geometry("230x340") 



#creation of an instance 
app = Window(root) 

#mainloop 
root.mainloop() 

편집 : 그냥 를 뜻하지 않은 시간에 나온 또 다른 문제는 되돌릴 수없는 것처럼 보입니다. 버튼의 바탕색과 입력 필드 주위의 프레임 MacOS 플랫폼을 사용하고 있기 때문에 읽을 수 있습니다. 해결 방법은 무엇입니까?

+0

: 여기

코드입니다 사진 : 나는 그와 함께 사진 작업과 버튼 배경 만들 수있는 방법을 찾을 수 있습니다 렌더링 = 광 화상 (파일 = "az.gif" "highlightbackground"추가하여) = 라벨 IMG (자기 이미지 = 렌더링 BG = "# E6E6E6") img.image = img.grid 렌더링 (= 8 행) 버튼 : goButton = 버튼 (self, text = "Go!", command = self.copyy, highli ghtbackground = "# E6E6E6") 하지만이 진행률 표시 줄, 여전히 팁을 전혀 알아낼 수 없습니까? – Bart

+0

'self.p.start()'를 호출 한 후 새 스레드에서 복사 기능을 시작해야합니다. 복사가 진행 막대를 애니메이션 처리하는 UI 스레드를 차단하고있을 수 있습니다. – Joules

+0

스레딩을 시도했지만 작동하지 않을 수 있습니다. 심지어 스레드를 사용할 때 파일이 복사되지 않고 있습니다. 아마도 잘못 구현 한 것 같지만 제대로 수행하는 방법을 찾지 못했습니다. 'self.p.start() root.update_idletasks() 내지 X (12)에 대한 : t = threading.Thread (목표 = self.copyy2) t.deamon = TRUE t.start() self.p.stop()' 그리고 나서'shutil.copytree (self.source_direcotry0, self.cam0)'는'copyy2'라는 새로운'def'로 옮겨졌습니다. – Bart

답변

0

로드 바를 압축하여 이전 프로젝트에서 작업하고 있습니다. 내가 알아 낸 유일한 방법은 진행률 표시 줄을 호출하여 새 스레드에서 호출을 처리하고이 스레드에서 작업 집약적 인 함수를 다른 새 스레드로 호출하는 것입니다.

진행률 표시 줄 시작 및 중지를 포함하여 UI 스레드 이외의 다른 UI 요소를 처리하는 별도의 스레드를 갖는 것은 좋지 않습니다. 그러나 그것은 효과가 있으며 저는이 프로젝트를 사용하여 몇 달 동안 제로 이슈로 꽤 많은 처리를 수행했습니다. 여기

진행 표시 줄이 W10에 파이썬 3.5.2를 사용하여 작은 스크립트에서 일하고

64 비트

from tkinter import * 
import tkinter.ttk as ttk 
import threading 
import time 

class Main_Frame(object): 
    def __init__(self, top=None): 
     # save root reference 
     self.top = top 
     # set title bar 
     self.top.title("Loading bar example") 

     # start button calls the "initialization" function bar_init, you can pass a variable in here if desired 
     self.start_button = ttk.Button(top, text='Start bar', command=lambda: self.bar_init(2500)) 
     self.start_button.pack() 

     # the progress bar will be referenced in the "bar handling" and "work" threads 
     self.load_bar = ttk.Progressbar(top) 
     self.load_bar.pack() 

     # run mainloop 
     self.top.mainloop() 

    def bar_init(self, var): 
     # first layer of isolation, note var being passed along to the self.start_bar function 
     # target is the function being started on a new thread, so the "bar handler" thread 
     self.start_bar_thread = threading.Thread(target=self.start_bar, args=(var,)) 
     # start the bar handling thread 
     self.start_bar_thread.start() 

    def start_bar(self, var): 
     # the load_bar needs to be configured for indeterminate amount of bouncing 
     self.load_bar.config(mode='indeterminate', maximum=100, value=0) 
     # 8 here is for speed of bounce 
     self.load_bar.start(8) 
     # start the work-intensive thread, again a var can be passed in here too if desired 
     self.work_thread = threading.Thread(target=self.work_task, args=(var,)) 
     self.work_thread.start() 
     # close the work thread 
     self.work_thread.join() 
     # stop the indeterminate bouncing 
     self.load_bar.stop() 
     # reconfigure the bar so it appears reset 
     self.load_bar.config(value=0, maximum=0) 

    def work_task(self, wait_time): 
     for x in range(wait_time): 
      time.sleep(0.001) 

if __name__ == '__main__': 
    # create root window 
    root = Tk() 
    # call Main_Frame class with reference to root as top 
    Main_Frame(top=root) 
+0

도움을 많이 주셔서 감사합니다. 소화하고 시험해 보는 데 약간의 시간이 걸리지 만, 의심 스럽다면 다시 돌아올 것입니다. 다시 한 번 감사드립니다! – Bart

+0

더 이상의 질문이 있으시면 언제든지 말씀해 주시면 최대한 도와 드리겠습니다. :) – Joules

0

그래서 난 내에서 개선을 위해 코드를 사용하고 그것을 작동합니다 :) 불행하게도 "but"가 있습니다. 따라서 파일을 복사하는 동안 진행 막대가 잘 움직입니다. 여전히 완전하지는 않지만 복사를 시작하기 전에 버튼을 눌러서 복사를 실행하면 상당히 지연됩니다. 평범한 사용자가 의심되는 프로그램이 시작될 정도로 길다.나는 스레드가 시작되는 방법에 연결되는 뭔가가 있다고 생각하지만 몇 가지 조합을 만들었고 그 중 아무 것도 문제를 개선하지 못했다고 생각합니다. 나는 당신이 무슨 일이 일어나고 있는지보기가 더 쉬울지라도 나는 전체 코드를 게시하고있다. 미리 감사드립니다 @ 주니어! Edit2가

from tkinter import * 
from tkinter import ttk 
import re 
from tkinter import messagebox 
from tkinter import filedialog 
import ntpath 
import os 
import shutil 
import tkinter.filedialog as fdialog 
from send2trash import send2trash 
from PIL import Image, ImageTk 
from threading import Thread 
import threading 


os.system('''/usr/bin/osascript -e 'tell app "Finder" to set frontmost of process "Python" to true' ''') 


# Here, we are creating our class, Window, and inheriting from the Frame 
# class. Frame is a class from the tkinter module. (see Lib/tkinter/__init__) 

class Window(Frame): 

    # Define settings upon initialization. Here you can specify 
    def __init__(self, master=None): 

     # parameters that you want to send through the Frame class. 
     Frame.__init__(self, master, bg="#E6E6E6") 

     #reference to the master widget, which is the tk window     
     self.master = master 

     #with that, we want to then run init_window, which doesn't yet exist 
     self.init_window() 

    def bar_init(self): 
     # first layer of isolation, note var being passed along to the self.start_bar function 
     # target is the function being started on a new thread, so the "bar handler" thread 
     self.start_bar_thread = threading.Thread(target=self.copyy, args=()) 
     # start the bar handling thread 
     self.start_bar_thread.start() 

    def copyy(self): 
     root.update_idletasks() 
     self.status['text'] = "Files are being copyied, have patience ;)".format(self.status) 


     self.source_direcotry0= '/Volumes/CAM0/DCIM/100HDDVR' 
     self.source_direcotry1= '/Volumes/CAM1/DCIM/100HDDVR' 
     self.source_direcotry2= '/Volumes/CAM2/DCIM/100HDDVR' 
     self.source_direcotry3= '/Volumes/CAM3/DCIM/100HDDVR' 
     self.source_direcotry4= '/Volumes/CAM4/DCIM/100HDDVR' 
     self.source_direcotry5= '/Volumes/CAM5/DCIM/100HDDVR' 
     self.source_direcotry6= '/Volumes/CAM6/DCIM/100HDDVR' 
     self.source_direcotry7= '/Volumes/CAM7/DCIM/100HDDVR' 
     self.source_direcotry8= '/Volumes/CAM8/DCIM/100HDDVR' 
     self.source_direcotry9= '/Volumes/CAM9/DCIM/100HDDVR' 
     self.source_direcotry10= '/Volumes/CAM10/DCIM/100HDDVR' 
     self.source_direcotry11= '/Volumes/CAM11/DCIM/100HDDVR' 

     self.path0="recording/CAM0" 
     self.path1="recording/CAM1" 
     self.path2="recording/CAM2" 
     self.path3="recording/CAM3" 
     self.path4="recording/CAM4" 
     self.path5="recording/CAM5" 
     self.path6="recording/CAM6" 
     self.path7="recording/CAM7" 
     self.path8="recording/CAM8" 
     self.path9="recording/CAM9" 
     self.path10="recording/CAM10" 
     self.path11="recording/CAM11" 

     self.cam0=os.path.join(self.Destination.get(), self.path0) 
     self.cam1=os.path.join(self.Destination.get(), self.path1) 
     self.cam2=os.path.join(self.Destination.get(), self.path2) 
     self.cam3=os.path.join(self.Destination.get(), self.path3) 
     self.cam4=os.path.join(self.Destination.get(), self.path4) 
     self.cam5=os.path.join(self.Destination.get(), self.path5) 
     self.cam6=os.path.join(self.Destination.get(), self.path6) 
     self.cam7=os.path.join(self.Destination.get(), self.path7) 
     self.cam8=os.path.join(self.Destination.get(), self.path8) 
     self.cam9=os.path.join(self.Destination.get(), self.path9) 
     self.cam10=os.path.join(self.Destination.get(), self.path10) 
     self.cam11=os.path.join(self.Destination.get(), self.path11) 

     self.p.start(1) 


     self.work_thread = threading.Thread(target=self.copyy2, args=()) 
     self.work_thread.start() 
     self.work_thread.join() 


     self.p.stop() 

     self.status['text'] = "Files have been copyied".format(self.status) 

    def copyy2(self): 

     shutil.copytree(self.source_direcotry0, self.cam0) 
     shutil.copytree(self.source_direcotry1, self.cam1) 
     shutil.copytree(self.source_direcotry2, self.cam2) 
     shutil.copytree(self.source_direcotry3, self.cam3) 
     shutil.copytree(self.source_direcotry4, self.cam4) 
     shutil.copytree(self.source_direcotry5, self.cam5) 
     shutil.copytree(self.source_direcotry6, self.cam6) 
     shutil.copytree(self.source_direcotry7, self.cam7) 
     shutil.copytree(self.source_direcotry8, self.cam8) 
     shutil.copytree(self.source_direcotry9, self.cam9) 
     shutil.copytree(self.source_direcotry10, self.cam10) 
     shutil.copytree(self.source_direcotry11, self.cam11) 

    def deletee(self): 
     send2trash('/Volumes/CAM0/DCIM') 
     send2trash('/Volumes/CAM1/DCIM') 
     send2trash('/Volumes/CAM2/DCIM') 
     send2trash('/Volumes/CAM3/DCIM') 
     send2trash('/Volumes/CAM4/DCIM') 
     send2trash('/Volumes/CAM5/DCIM') 
     send2trash('/Volumes/CAM6/DCIM') 
     send2trash('/Volumes/CAM7/DCIM') 
     send2trash('/Volumes/CAM8/DCIM') 
     send2trash('/Volumes/CAM9/DCIM') 
     send2trash('/Volumes/CAM10/DCIM') 
     send2trash('/Volumes/CAM11/DCIM') 

     self.status['text'] = "Files have been moved to trash".format(self.status) 


    def client_exit(self): 
     exit() 

    def about_popup(self): 
     messagebox.showinfo("About", "This is software used to copy or delete files in bulk from the Absolute Zero VR camera") 


    #Creation of init_window 
    def init_window(self): 

     self.Source=StringVar() 
     self.Destination=StringVar() 


     # changing the title of our master widget  
     self.master.title("AZ Data Extractor") 

     # allowing the widget to take the full space of the root window 
     self.pack(fill=BOTH, expand=1) 

     #Creating the menu 
     self.menubar = Menu(self.master) 

     #Creating submenues 
     self.filemenu = Menu(self.menubar, tearoff=0) 
     self.filemenu.add_command(label="Exit", command=root.quit) 
     self.menubar.add_cascade(label="File", menu=self.filemenu) 

     self.helpmenu = Menu(self.menubar, tearoff=0) 
     self.helpmenu.add_command(label="About", command=self.about_popup) 
     self.menubar.add_cascade(label="Help", menu=self.helpmenu) 

     #Displaying the menu 
     root.config(menu=self.menubar) 

     #Creating the intro label 
     l_instruction = Label(self, justify=CENTER, compound=TOP, text="Choose the destination for the copied files \n and press 'Go!' to start copyting", bg="#E6E6E6") 
     l_instruction.grid(columnspan=2, ipady=10) 

     l_instruction = Label(self, justify=CENTER, compound=TOP, text="Press 'Delete' to move all files \n from the camera to the trash", bg="#E6E6E6") 
     l_instruction.grid(row=6, columnspan=2, ipady=10) 

     #Creating the button 
     MyDestination=Entry(self, textvariable=self.Destination,highlightbackground="#E6E6E6") 
     MyDestination.grid(row=2, columnspan=2, ipady=10) 
     uploadButton = Button(self, text="Choose destination folder",command=lambda:self.Destination.set(fdialog.askdirectory()),highlightbackground="#E6E6E6") 
     uploadButton.grid(row=3, columnspan=2, ipady=10) 
     goButton = Button(self, text="Go!",command=self.bar_init,highlightbackground="#E6E6E6") 
     goButton.grid(row=4, columnspan=2, ipady=10) 
     delButton = Button(self, text="Delete",command=self.deletee,highlightbackground="#E6E6E6") 
     delButton.grid(row=7, columnspan=2, ipady=10) 

     s = ttk.Style() 
     s.theme_use('alt') 
     s.configure("grey.Horizontal.TProgressbar", troughcolor='#E6E6E6', background='gray', bordercolor='#E6E6E6') 

     self.p = ttk.Progressbar(self, style="grey.Horizontal.TProgressbar", orient=HORIZONTAL, length=300, mode='indeterminate') 
     self.p.grid(row=5) 

     render = PhotoImage(file="az.gif") 
     img = Label(self, image=render, bg="#E6E6E6") 
     img.image = render 
     img.grid(row=10) 

     space = Label(self, bg="#E6E6E6") 
     space.grid(row=8) 
     space2 = Label(self, bg="#E6E6E6") 
     space2.grid(row=9) 
     space3 = Label(self, bg="#E6E6E6") 
     space3.grid(row=11) 


     #resizing configuration 
     self.grid_columnconfigure(0,weight=1) 
     self.grid_columnconfigure(1,weight=1) 
     self.grid_rowconfigure(0,weight=1) 
     self.grid_rowconfigure(1,weight=1) 
     self.grid_rowconfigure(2,weight=1) 
     self.grid_rowconfigure(3,weight=1) 
     self.grid_rowconfigure(4,weight=1) 
     self.grid_rowconfigure(5,weight=1) 
     self.grid_rowconfigure(6,weight=1) 
     self.grid_rowconfigure(7,weight=1) 
     self.grid_rowconfigure(8,weight=1) 
     self.grid_rowconfigure(9,weight=1) 
     self.grid_rowconfigure(10,weight=1) 
     self.grid_rowconfigure(11,weight=1) 


     #status Bar 
     self.status = Label(self.master, text="Waiting for process to start...", bd=1, relief=SUNKEN, anchor=W) 
     self.status.pack(side=BOTTOM, fill=X) 


# root window created. Here, that would be the only window, but you can later have windows within windows. 
root = Tk() 
root.resizable(width=False,height=False); 
#root.geometry("230x340") 



#creation of an instance 
app = Window(root) 

#mainloop 
root.mainloop() 
+0

나는이 지연이 언제나 똑같지는 않다는 것을 깨달았습니다. 어떤 때는 더 크고 때로는 아주 작습니다. 어쩌면 코드가 아닌 외부 요인 때문일 수 있습니까? 그러나 다른 한편으로는 스레딩을 도입하기 전에 복사 기능이 항상 즉시 실행되었습니다. – Bart

관련 문제