0
중간에 레이블을 추가하는 Tkinter-Python에서 진행 표시 줄을 향상시킬 수 있습니까 (예 : 파일 읽기)? 레이블이있는 Tkinter의 진행 표시 줄
나는 우아한 코딩 해결책을 찾기 위해 노력하지만 실제 결과없이from Tkinter import *
import ttk
import tkFileDialog
import time
class MainWindow(Frame):
def __init__(self):
Frame.__init__(self)
self.master.title("ProgressBar example")
self.master.minsize(200, 100)
self.grid(sticky=E+W+N+S)
top = self.winfo_toplevel()
top.rowconfigure(0, weight=1)
top.columnconfigure(0, weight=1)
self.start_ind = Button(self, text='Start indeterminate', command=self.start_ind, activeforeground="red")
self.start_ind.grid(row=0, column=0, pady=2, padx=2, sticky=E+W+N+S)
self.pbar_ind = ttk.Progressbar(self, orient="horizontal", length=300, mode="indeterminate")
self.pbar_ind.grid(row=1, column=0, pady=2, padx=2, sticky=E+W+N+S)
def start_ind(self):
for i in xrange(50):
self.pbar_ind.step(1)
self.update()
# Busy-wait
time.sleep(0.1)
if __name__=="__main__":
d = MainWindow()
d.mainloop()
설명서에는 진행률 표시 줄 위젯에 레이블을 포함하는 것에 대한 언급이 없으며 일반적으로 지원되지 않는다는 것을 의미합니다. 사용자 정의 위젯을 작성해야합니다. –