import sys
from PyQt4 import QtCore, QtGui
from calculatorform_ui import Ui_CalculatorForm
from ui_countNumbers import Ui_MainWindow
from time import sleep
class WorkerThread
(QtCore.
QThread): def __init__(self, form, start, end):
self.start = start
self.end = end
self.form = form
def run(self):
c = C()
QtCore.
QObject.
connect(form.
ui.
progressBar, c.
update, form, QtCore.
SLOT("setValue(int)"))
for x in range(start, end):
c.emit(c.update, x)
update = QtCore.SIGNAL("update(int)")
def __init__(self, parent=None):
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
@QtCore.pyqtSignature("")
def on_start_clicked(self):
t = WorkerThread(self, self.ui.spFrom.value(), self.ui.spTo.value() + 1);
t.start()
import sys
from PyQt4 import QtCore, QtGui
from calculatorform_ui import Ui_CalculatorForm
from ui_countNumbers import Ui_MainWindow
from time import sleep
class WorkerThread(QtCore.QThread):
def __init__(self, form, start, end):
QtCore.QThread.__init__(self)
self.start = start
self.end = end
self.form = form
def run(self):
c = C()
QtCore.QObject.connect(form.ui.progressBar, c.update, form, QtCore.SLOT("setValue(int)"))
for x in range(start, end):
c.emit(c.update, x)
class C(QtCore.QObject):
update = QtCore.SIGNAL("update(int)")
class CountNumbersForm(QtGui.QMainWindow):
def __init__(self, parent=None):
QtGui.QMainWindow.__init__(self, parent)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
@QtCore.pyqtSignature("")
def on_start_clicked(self):
t = WorkerThread(self, self.ui.spFrom.value(), self.ui.spTo.value() + 1);
t.start()
To copy to clipboard, switch view to plain text mode
Bookmarks