[英]How to create progress bar with status?
I want to create a progress bar (GUI) in python.我想在 python 中创建一个进度条(GUI)。 I am not sure how to do this in graphical version
我不确定如何在图形版本中执行此操作
I want it to print status in the output box too.我也希望它在 output 框中打印状态。
I am using progressbar2 right now我现在正在使用progressbar2
So here is my code:所以这是我的代码:
import time
import progressbar
for i in progressbar.progressbar(range(100)):
time.sleep(0.02)
Here is a small example for you to add progress bar in gui with status
这是一个小示例,您可以在 gui 中添加带有状态的进度条
from tkinter import *
from tkinter.ttk import *
import time
root=Tk()
root.title("hi")
root.geometry("600x400")
a=IntVar()
prog=Progressbar(root,orient=HORIZONTAL,length= 300,mode = 'determinate' )
def step():
for x in range(5):
prog['value']+=20
a.set(prog['value'])
root.update_idletasks()
time.sleep(1)
prog.pack(pady=20)
butn=Button(root,text='Progress',command=step).pack(pady=20)
lb=Entry(root,textvar=a).pack(pady=20)
root.mainloop()
It think it may help you它认为它可以帮助你
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.