Python ttk 模块,Progressbar() 实例源码

我们从Python开源项目中,提取了以下13个代码示例,用于说明如何使用ttk.Progressbar()

项目:Scoary    作者:AdmiralenOla    | 项目源码 | 文件源码
def initialize_statusframe(self):
        """
        Initialize the frame and statusbar occupying the bottom
        """
        frame = self.bottompart

        frame.pb = ttk.Progressbar(frame,
                                   orient='horizontal',
                                   mode='determinate',
                                   maximum=100)
        frame.pb.pack(fill='both',expand=True,side='top')

        frame.lab = Tkinter.Label(frame,text=u"Awaiting input options")
        frame.lab.pack(in_=frame.pb,expand=True)
        #sys.stdout = StdoutToLabel(frame.lab, progressbar=frame.pb)
        sys.stdout = StdoutToLabel(frame.lab,
                                   progressbar=frame.pb,
                                   width=frame.cget('width'))
项目:audiojack-ui    作者:anilee    | 项目源码 | 文件源码
def search(self, event=None):
        global run
        run = True
        input = self.url_input.get(0.0, END).replace('\n', '').replace(' ', '').replace('\t', '')
        self.reset()
        self.q = Queue.Queue()
        t = Thread(target=self.get_results, args=[input])
        t.daemon = True
        t.start()
        self.disable_search()
        self.search_progress = ttk.Progressbar(self.mainframe, length=200, mode='indeterminate')
        self.search_progress.pack()
        self.search_progress.start(20)
        self.cancel = ttk.Button(self.mainframe, text='Cancel', command=self.cancel_search)
        self.cancel.pack()
        self.master.after(100, self.add_results)
项目:gophersnake    作者:felixplesoianu    | 项目源码 | 文件源码
def load_with_status(entry, callback):
    prog_win = Toplevel(top, padx=8, pady=8)
    prog_win.title = "Loading..."
    prog_win.transient(top)
    prog_win.resizable(FALSE, FALSE)

    prog_bar = ttk.Progressbar(
        prog_win, orient=HORIZONTAL, length=300, mode="indeterminate")
    prog_bar.pack()

    data = b""
    try:
        for i in fetch_data(entry[2], entry[3], int(entry[4])):
            data += i
            prog_bar.step()
        callback(entry2url(entry), data)
    except Exception as e:
        showerror(
            parent=top,
            title="Error loading content",
            message=str(e))
    finally:
        prog_win.destroy()
项目:oil    作者:oilshell    | 项目源码 | 文件源码
def create(self, **kwargs):
        return ttk.Progressbar(self.root, **kwargs)
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def create(self, **kwargs):
        return ttk.Progressbar(self.root, **kwargs)
项目:seu-jwc-catcher    作者:LeonidasCl    | 项目源码 | 文件源码
def login_start(self):
    global progress_var
    global progress_bar
    global progressLabel
    progress_var = DoubleVar()
    labelfont = ('times', 40, 'bold')
    progressLabel = Label(root, text="????????...", pady=110)
    progressLabel.config(font=labelfont)
    progressLabel.pack()
    progress_bar = ttk.Progressbar(root, variable=progress_var, maximum=100)
    progress_bar.pack(fill=BOTH, padx=20, pady=100)
    pass
项目:audiojack-ui    作者:anilee    | 项目源码 | 文件源码
def download(self, index):
        self.reset()
        self.download_queue = Queue.Queue()
        dl_t = Thread(target=self.get_file, args=[index, self.download_queue])
        dl_t.daemon = True
        dl_t.start()
        self.disable_search()
        self.download_progress = ttk.Progressbar(self.mainframe, length=200, mode='indeterminate')
        self.download_progress.pack()
        self.download_progress.start(20)
        self.master.after(100, self.add_file)
项目:PIEFACE    作者:jcumby    | 项目源码 | 文件源码
def __init__(self, parent=None):
        self.parent = parent
        tk.Toplevel.__init__(self)
        #self.win = tk.Toplevel(parent)
        self.iconbitmap(iconloc)
        self.title('Busy')
        self.resizable(False, False)
        self.message = ttk.Label(self, text='Please wait. This may take a long time.')
        self.message.grid(column = 0, row=0, sticky = tk.N, padx=5, pady=5)
        self.prog = ttk.Progressbar(self, mode = 'indeterminate', orient=tk.HORIZONTAL, maximum=30)
        self.prog.grid(column=0, row=1, sticky=(tk.E, tk.W), padx=5, pady=5)
        tip = ttk.Label(self, text='[Tip: Perhaps a good time for a coffee?]')
        tip.grid(column=0, row=2, sticky=tk.S, padx=5, pady=5)
        #self.cancel = ttk.Button(self, text='Cancel', command=self.cancel)
        #self.cancel.grid(column=0, row=2, pady=5)
项目:Course-Page-Downloader    作者:kp96    | 项目源码 | 文件源码
def __init__ (self, root):
        self.root = root
        root.title ("Course Page Downlaoder")
        mainframe = ttk.Frame(root, padding="3 3 12 12")
        mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
        mainframe.columnconfigure(0, weight=1)
        mainframe.rowconfigure(0, weight=1)
        self.mainframe = mainframe
        ttk.Label(mainframe, text="Registration Number").grid(row=0, column=0)
        self.regno = StringVar()
        self.pwd = StringVar()
        self.cache = IntVar()
        self.cache.set(1)
        self.progress = IntVar()
        self.progress.set(0)
        self.hint = StringVar()
        print "mama here"
        self.hint.set("Hit Download or Return to Proceed")
        self.regno_entry = ttk.Entry(self.mainframe, width=60, textvariable=self.regno)
        self.regno_entry.grid(column=0, row=1, sticky=(E))
        self.pwd_label = ttk.Label(self.mainframe, text="Password").grid(row=2, column=0)
        self.pwd_entry = ttk.Entry(self.mainframe, width=60, show='*', textvariable=self.pwd)
        self.pwd_entry.grid(column=0, row=3, sticky=(E))
        self.cb = ttk.Checkbutton(self.mainframe, text="Remember Me", variable = self.cache)
        self.cb.grid(column=0, row=4)
        self.dlbutton = ttk.Button(self.mainframe, text="Download", command= lambda: self.calculate())
        self.dlbutton.grid(column = 0, row=5)
        for child in self.mainframe.winfo_children(): child.grid_configure(padx=5, pady=5)
        self.hint_label = ttk.Label(self.mainframe, text="Press Download to Begin", justify='center')
        self.hint_label.grid(row=6)
        self.prgbar = ttk.Progressbar(self.mainframe, orient='horizontal', mode='determinate', variable=self.progress).grid(column=0, row=7)
        self.regno_entry.focus()
项目:3D-SCANNER-IITB    作者:animeshsrivastava24    | 项目源码 | 文件源码
def ProgressbarWindow(self):

        self.ProgressVar = tk.DoubleVar() #here you have ints but when calc. %'s usually floats
        self.TheLabel = tk.Label(self.root, text="Percentage completed")
        self.TheLabel.pack()
        self.progressbar = ttk.Progressbar(self.root, variable=self.ProgressVar, maximum=48)
        self.progressbar.pack()
项目:gophersnake    作者:felixplesoianu    | 项目源码 | 文件源码
def save_with_status(selector, host, port):
    fn = asksaveasfilename(parent=top, title="Save file as")
    if fn == "":
        return

    prog_win = Toplevel(top, padx=8, pady=8)
    prog_win.title = "Downloading..."
    prog_win.transient(top)
    prog_win.resizable(FALSE, FALSE)

    prog_bar = ttk.Progressbar(
        prog_win, orient=HORIZONTAL, length=300, mode="indeterminate")
    prog_bar.pack()

    try:
        with open(fn, "wb") as f:
            for i in fetch_data(selector, host, port):
                f.write(i)
                prog_bar.step()
        return True
    except Exception as e:
        showerror(
            parent=top,
            title="Error loading content",
            message=str(e))
        return False
    finally:
        prog_win.destroy()
项目:goreviewpartner    作者:pnprog    | 项目源码 | 文件源码
def initialize_UI(self):

        self.max_move=get_moves_number(self.move_zero)
        if not self.move_range:
            self.move_range=range(1,self.max_move+1)

        self.total_done=0

        root = self
        root.parent.title('GoReviewPartner')
        root.parent.protocol("WM_DELETE_WINDOW", self.close_app)


        Label(root,text="Analysis of: "+os.path.basename(self.filename)).pack()

        self.lab1=Label(root)
        self.lab1.pack()

        self.lab2=Label(root)
        self.lab2.pack()

        self.lab1.config(text="Currently at move 1/"+str(self.max_move))

        self.pb = ttk.Progressbar(root, orient="horizontal", length=250,maximum=self.max_move+1, mode="determinate")
        self.pb.pack()

        current_move=1

        try:
            write_rsgf(self.filename[:-4]+".rsgf",self.g.serialise())
        except Exception,e:
            show_error(str(e))
            self.lab1.config(text="Aborted")
            self.lab2.config(text="")
            return

        self.lock2.acquire()
        self.t0=time.time()
        first_move=go_to_move(self.move_zero,1)
        first_comment="Analysis by GoReviewPartner"
        first_comment+="\nBot: "+self.bot_name+'/'+self.bot_version
        first_comment+="\nKomi: "+str(self.komi)
        first_comment+="\nIntervals: "+self.intervals
        first_move.add_comment_text(first_comment)
        threading.Thread(target=self.run_all_analysis).start()

        self.root=root
项目:serialplot    作者:crxguy52    | 项目源码 | 文件源码
def __init__(self, parent, root):
        ttk.Frame.__init__(self, parent)
        self.parent = parent
        self.root = root
        self['borderwidth'] = 2
        self['relief'] = 'sunken'

        COMlabel = ttk.Label(self, text= \
            self.root.variables['COMport'][0:5].strip() + ':')
        baudLabel = ttk.Label(self, text= \
            str(self.root.variables['baud'].strip()))
        COMlabel.pack(side='left', padx=0)
        baudLabel.pack(side='left', padx=0) 

        ttk.Separator(self, orient='vertical').pack(side='left', fill='y', padx=5)       

        buffLabel = ttk.Label(self, text='Serial Buffer:')
        buffLabel.pack(side='left', padx=0)

        buffBar = ttk.Progressbar(self, orient='horizontal', length=50,\
            mode='determinate', variable=self.root.variables['buffsize'],\
            maximum=io.DEFAULT_BUFFER_SIZE)
        buffBar.pack(side='left')

        ttk.Separator(self, orient='vertical').pack(side='left', fill='y', padx=5)

        lastLabel = ttk.Label(self, text='Last line Recieved: ')
        lastLabel.pack(side='left')
        lastLine = ttk.Label(self, textvariable=self.root.variables['lastline'], \
            font=('Courier', 8))
        lastLine.pack(side='left')

        ttk.Separator(self, orient='vertical').pack(side='left', fill='y', padx=5)

        updateLabel = ttk.Label(self, text='Data Recieved at: ')
        updateLabel.pack(side='left')
        updateRate = ttk.Label(self, textvariable=self.root.variables['refreshrate'])
        updateRate.pack(side='left')
        ttk.Label(self, text='Hz (Est)').pack(side='left')

        ttk.Separator(self, orient='vertical').pack(side='left', fill='y', padx=5)        

        if self.root.variables['log2file'] == 'on':
            self.root.toggleLogButton = ttk.Button(self, text='Turn Logging Off', command = self.toggleLog)
            self.root.toggleLogButton.pack(side='left')