Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/346.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 当我的值超过100时,如何才能准确显示progressbar结果_Python_Pyqt_Pyqt5 - Fatal编程技术网

Python 当我的值超过100时,如何才能准确显示progressbar结果

Python 当我的值超过100时,如何才能准确显示progressbar结果,python,pyqt,pyqt5,Python,Pyqt,Pyqt5,我有一个范围从0到100000的循环,我想在进度条中显示它的准确进度,但我的进度条在完成100%的进度后仍会运行,所以当我循环100000次时,如何才能显示实际进度 我的python pyqt5代码:- bar.setMinimum(0) bar.setMaximum(100) for i in range(0,100000): ### Here is my function that perform my process and delay for 1

我有一个范围从0到100000的循环,我想在进度条中显示它的准确进度,但我的进度条在完成100%的进度后仍会运行,所以当我循环100000次时,如何才能显示实际进度

我的python pyqt5代码:-

  bar.setMinimum(0)
  bar.setMaximum(100)

  for i in range(0,100000):
         ### Here is my function that perform my process and delay for 1 
         ## second
         bar.setValue(i)

您是如何初始化进度条的?我只是通过将最小值设置为=0,最大值设置为100来初始化进度条的。为什么不向我们显示用于初始化进度条的代码?需要33毫秒以上(近似值)的任务会阻塞GUI,因此它们不应在GUI线程中运行,如果它们在您的情况下按原样运行,会产生不需要的效果,例如不更新GUI,那么您必须在另一个线程中运行它。那么我该如何解决这个问题?