Hi
need help passing an argument through signal emitted from a function at module level,
when the function is executed I want to emit a signal with an argument whose value i want to pass to the method that is connected to that signal in the class in that same module. the class is the QWidget UI
from PyQt4.QtCore import pyqtSignal, pyqtSlot
from PyQt4.QtGui import QWidget, QApplication
from PyQt4 import QtCore
import sys
_qObject = QtCore.QObject()
has_error = pyqtSignal(Exception)
class SomeOtherClass(QWidget):
# this is my UI class
def __init__(self, parent=None):
super(SomeOtherClass, self).__init__(parent)
# Initialise the Class and connect signal to slot
QtCore.QObject.connect(_qObject, has_error, self.thrown_error)
# QtCore.QObject.has_error.connect(self.thrown_error)
@pyqtSlot(Exception)
def thrown_error(self, my_err):
#Do Stuff with the Exception
print(type(my_err), my_err)
self.close()
def makeError():
try:
print 1/0
except ZeroDivisionError, ze:
has_error.emit(ze)
makeError()
app = QApplication(sys.argv)
SomeOtherClass()
but this is throwing me error..