[PyQt] Connecting signals and slots?

Jason H jhihn at gmx.com
Sun Mar 1 00:48:02 GMT 2015


How can I make the connection in Other.run()? The two approaches I tried get the errors in the comments.

Thanks

class.py----
class Class:
	doneVis1 = pyqtSignal()
	doneVis2 = pyqtSignal()

other.py-----
class Other:
	def run(self):
		self.script = __import__('class')
		self.c = self.script.Class()
		self.c.doneVis1.connect(self.doneVis1) #TypeError: instance cannot be converted to PyQt5.QtCore.QObject in this context
		self.script.Class.doneVis2.connect(self.doneVis2) #AttributeError: 'PyQt5.QtCore.pyqtSignal' object has no attribute 'connect'
		c.run()
	def doneVis1(self):
		pass
	def doneVis2(self):
		pass


More information about the PyQt mailing list