python tkinter progressbar_Tkinter中带有标签的progressbar

有没有可能在Tkinter Python中改进progressbar,在中间添加一个标签(例如:读取文件)?在

我试图找到一个优雅的编码解决方案,但没有真正的结果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()

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值