子进程完成后ProgressBar不会停止

时间:2016-01-26 05:37:11

标签: python tkinter progress-bar

这是我的进度条代码,用于向我的子流程添加进度:

    ft = ttk.Frame(self.labelframe)
    fb = ttk.Frame(self.labelframe)

    ft.pack(expand=True, fill=tk.BOTH, side=tk.TOP)
    fb.pack(expand=True, fill=tk.BOTH, side=tk.TOP)

    self.pb_hd = ttk.Progressbar(ft, orient='horizontal', mode='determinate')
    self.pb_hd.pack(expand=False, fill=tk.X, side=tk.TOP)

    cmd = ["adb","pull","/data","/home/User/Project/Internal-Storage"]
    self.proc = subprocess.Popen(cmd, shell=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT )
    self.pb_hd.start()

    while self.proc.poll() is None:
          self.update()

    self.pb_hd.stop()

pb_hd.stop()似乎不起作用 如何在进度条中添加百分比以让用户知道进程完成进度。

0 个答案:

没有答案