0

I want to create a progress bar (GUI) in python. I am not sure how to do this in graphical version

I want it to print status in the output box too.

I am using progressbar2 right now

So here is my code:

import time
import progressbar

for i in progressbar.progressbar(range(100)):
    time.sleep(0.02)
Alex Zab
  • 312
  • 2
  • 18
Sashank
  • 491
  • 5
  • 16

1 Answers1

1

Here is a small example for you to add progress bar in gui with status

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

Ujjwal Dash
  • 602
  • 1
  • 2
  • 8