Python Forum
How can I add a progress bar for my software?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How can I add a progress bar for my software?
#7
hi guys and thanks a lot for your quickly replies. I followed your advices and I tried to study how the "tqdm" library works but I really don't understand how to use it with my script.

from what I understood with tqdm I can create a progress bar to check a "for" loop in real time. I wrote an example below:

text = "hola\nciao\nhi\nsalut\nпривет"

import time
from tqdm import tqdm

for line in tqdm(text.split()):
    time.sleep(2)
for each line in "text", the script waits 2 seconds. when I run it the progress bar created by tqdm go ahead every 2 seconds and in 10 seconds it covers all the bar.

ok, it's simple, but what about if I have many "for" loops in my script? most of my code is composed by many "for" loops. maybe I could apply tqdm for all of them, but how can I do it and at the same time have an unique loading bar?

then I have another dubt. even if I applied qtdm for each "for" loop, what about the rest of the code? I have some "while" loops too, and other "if/elif/else" instructions. they help me to read some text files, and create new variables.

maybe I could simply print an empty progress bar at the first time and then full it every some pice of code read, i don't know.


(Nov-12-2019, 04:17 PM)perfringo Wrote: I remember the days when “beginner” was something which didn’t comprise ability to write 1000 lines of code with CLI interface.... Big Grin

yeah, let me explain me better ahah.. in Python I know many topics but i'm not an expert. I read the free book "Think Python" and I followed many tutorials online. now I can do many things but currently I can't still program with the classes. I'm still studying.
Reply


Messages In This Thread
RE: How can I add a progress bar for my software? - by aquerci - Nov-15-2019, 09:43 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Progress bar bnadir55 1 1,839 Apr-11-2022, 01:52 PM
Last Post: deanhystad
  Progress Indicator for Xmodem 0.4.6 KenHorse 1 1,984 Jan-30-2021, 07:12 PM
Last Post: bowlofred
  wget progress bar anasrocks 1 4,740 Jun-06-2019, 03:12 PM
Last Post: heiner55
  Progress Finished Question malonn 32 17,668 May-23-2018, 02:43 AM
Last Post: malonn
  how to progress with py jakegold98 1 2,640 Dec-05-2017, 02:58 AM
Last Post: micseydel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020