qprogressbar

What is the proper way to set QProgressBar to update from the logic layer?

♀尐吖头ヾ 提交于 2019-11-30 17:32:47
If I want to update a QProgressBar on the view layers from a loop on the logic layer (such as each iteration will update the progress bar), what is the proper way to do that? Thanks class LogicClass : public QObject { Q_OBJECT public: explicit LogicClass(QObject *parent = 0); int max(){ return 100; } int min(){ return 0; } void emit50(){ emit signalProgress(50); } signals: void signalProgress(int); public slots: }; MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); LogicClass logic; ui->progressBar->setMaximum( logic.max() ); ui-

PyQt ProgressBar

泪湿孤枕 提交于 2019-11-27 21:30:27
When using the following code my application stalls after a couple of seconds. And by stalls I mean hangs. I get a window from Windows saying wait or force close. I might add that this only happens when I click either inside the progress bar window or when I click outside of it so it loses focus. If I start the example and do not touch anything it works like it should. from PyQt4 import QtCore from PyQt4 import QtGui class ProgressBar(QtGui.QWidget): def __init__(self, parent=None, total=20): super(ProgressBar, self).__init__(parent) self.name_line = QtGui.QLineEdit() self.progressbar = QtGui

Changing the color of a QProgressbar()

时光毁灭记忆、已成空白 提交于 2019-11-27 06:19:07
问题 I was wondering whether it's possible to change the color of a PyQt Progressbar? I have the following code: from PyQt4 import QtGui, QtCore Pbar1 = QtGui.QProgressBar() Pbar1.setParent(Frame1) Pbar1.setGeometry(0, 0, 306, 30) Pbar1.setValue(Frame1Value) if Pbar1.value == 100 ......Pbar1.setColor(Red) Frame1Value is dependable on some early calculations, and to be assumed never calculates to exactly the same value. I would like the progressbar to turn 'red' when the value is 100 (which the

PyQt ProgressBar

99封情书 提交于 2019-11-27 04:30:51
问题 When using the following code my application stalls after a couple of seconds. And by stalls I mean hangs. I get a window from Windows saying wait or force close. I might add that this only happens when I click either inside the progress bar window or when I click outside of it so it loses focus. If I start the example and do not touch anything it works like it should. from PyQt4 import QtCore from PyQt4 import QtGui class ProgressBar(QtGui.QWidget): def __init__(self, parent=None, total=20):

PyQt QProgressBar not working when I use it with Selenuim

无人久伴 提交于 2019-11-26 23:18:17
I built a PyQt5 GUI to do some Selenium testing. Everything works as expected, except for the PyQt progress bar. In the first example below, where I use the Selenium browser, the progress bar just jumps to 100%, at the end, when the browser closes. But, the Selenium works as expected. def test(self): self.completed = 0 browser = webdriver.Firefox() links = ['http://www.somesite.com/', 'http://www.somesite.com/page2', 'http://www.somesite.com/page3'] for link in links: browser.get(link) self.completed += 100 / len(links) time.sleep(2) print(link) self.progressBar.setValue(self.completed)

PyQt progress jumps to 100% after it starts

拈花ヽ惹草 提交于 2019-11-26 17:23:44
问题 When I run the code in the in the doWork method, by clicking the button1 , the progress bar works as expected. However, when I pass the list to the doWork method from other methods (i.e. btn2 , btn3 ), the progress bar just jumps to 100% after it starts. from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtWidgets import * from PyQt5.QtCore import * from PyQt5.QtGui import * import sys from selenium import webdriver class SeleniumWorker(QtCore.QObject): progressChanged = QtCore.pyqtSignal