Python Forum
is there an easy way to add a progress bar/counter to an existing script
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
is there an easy way to add a progress bar/counter to an existing script
#6
You dont need script() or task() functions at all. It was just an illustration of how to use it. Script being your entire program, and task being any function within your program that does something as the purpose of the program's existance

Put progress(0) in the beginning of your script, and progress(100) at the end of it. Then divide 100 by your programs' number of tasks and put progress(THAT_NUM) after task 1, program(THAT_NUM*2) after task 2, program(THAT_NUM*3) after task 3, etc.

Quote:
    progress(0,'running task 1')
    task()
    progress(20,'running task 2')
    task()
    progress(40,'running task 3')
    task()
    progress(60,'running task 4')
    task()
    progress(80,'running task 5')
    task()
    progress(100, '   complete   ')
In this case there are 5 tasks throughout the entire program progressing the bar 20% each time. 100/5=20 100/number of tasks = percentage to increase after each task
Recommended Tutorials:
Reply


Messages In This Thread
RE: is there an easy way to add a progress bar/counter to an existing script - by metulburr - Jun-09-2019, 05:20 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Python beginner that needs an expression added to existing script markham 1 815 Sep-04-2023, 05:24 AM
Last Post: Pedroski55
  Progress bar bnadir55 1 1,962 Apr-11-2022, 01:52 PM
Last Post: deanhystad
  Progress Indicator for Xmodem 0.4.6 KenHorse 1 2,097 Jan-30-2021, 07:12 PM
Last Post: bowlofred
  Need help creating complex loop around existing script CephloRhod 5 2,935 Apr-16-2020, 01:23 PM
Last Post: deanhystad
  How can I add a progress bar for my software? aquerci 8 3,983 Nov-16-2019, 04:20 PM
Last Post: aquerci
  wget progress bar anasrocks 1 4,838 Jun-06-2019, 03:12 PM
Last Post: heiner55
  Progress Finished Question malonn 32 18,260 May-23-2018, 02:43 AM
Last Post: malonn
  Seeking feedback on my script-in-progress league55 2 2,792 Feb-12-2018, 03:03 PM
Last Post: league55
  how to progress with py jakegold98 1 2,722 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