Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 How can I measure progress and display it in the progress bar in the interface?
#1
Hello. I created a graphic interface using QtDesigner, which, when you press the OK button, runs a script that sequentially runs many programs.
The script is run by the subprocess.call command and contains many of these commands that execute all scripts from the project in sequence. The time it takes to execute all commands is long (about 20min), therefore you need a command bar in the interface. How can I measure the progress of scripting and how can I pass that progress to the progress bar in the interface?
Quote
#2
Is there any to know your total progress as it's running? Like, when it completes one script and moves to the next?

If so, my first thought is to draw a rectangle as your progress bar and when it goes from one script to the next have a line that modifies the "width" of rectangle to the value that reflects where in the sequence it is. It won't move smoothly, but I've never seen one that did anyway. lol
Quote
#3
First and foremost the fact that you are using the Designer to create your Gui is just going to be fraught with much development pain continuously. This if for 2 reasons (1) Its black-box untouchable code and this should be avoided as much as possible in a coding situation and only when absolutely necessary and never self-inflicted which is what you do when you use the Designer (2) The process of learning to use the Designer correctly actually takes more time than learning to use Python-Qt correctly (be it PyQt5, PySide2 or any other flavor) (3) Once you learn how to use Python-Qt as it was meant to be used it is nearly as fast initially as the Designer and definitely a lot faster later on -- when you go to make changes and such.

Okay that being said as @michael1789 eludes to you will need to be able to denote to your parent (that handles the progress bar) the status of its child (or children) as to their current state. I would suggest perhaps looking into QThreading the sub-processes and having the Signal back to the Parent at specific intervals as I think that might be the most straight-forward and perhaps best way to handle this -- not I am not saying its the easiest because unless you have played with QThreads before you might have them a bit tricky especially since the how to in the Qt Documentation is wrong (old Python-Qt4 docos vs current Python-Qt5) which is to say you do not, and let me repeat you do not -- sub-class a QThread in Python-Qt5

If you need more help on this and/or want help on how to learn proper Python-Qt just shoot out another question I have no problems helping teach others how to properly use Python-Qt and I, in fact, run a free Discord classroom for this very purpose.
silly American kah-nig-hit
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  [Tkinter] tkinter progress bar for decending number justaloser 1 197 Nov-10-2019, 12:31 AM
Last Post: Larz60+
  [Tkinter] Progress Bar While Sending an Email maxtimbo 3 375 Oct-09-2019, 09:13 PM
Last Post: woooee
  Progress Bar While Sending an Email maxtimbo 0 201 Oct-08-2019, 02:13 PM
Last Post: maxtimbo
  Need help setting up a PySimpleGUI progress bar that I can maually update in script Soundtechscott 1 1,189 Jun-10-2019, 06:14 AM
Last Post: Soundtechscott
  Display and update the label text which display the serial value jenkins43 5 1,721 Feb-04-2019, 04:36 AM
Last Post: Larz60+
  Display more than one button in GUI to display MPU6000 Sensor readings barry76 4 711 Jan-05-2019, 01:48 PM
Last Post: wuf
  GUI Progress Bar Anysja 6 1,825 Aug-29-2018, 02:34 PM
Last Post: swetanjali
  [PyQt] cant import progress bar from another py file swipis 7 3,622 Dec-18-2016, 10:41 AM
Last Post: swipis

Forum Jump:


Users browsing this thread: 1 Guest(s)