[PyQt] Connecting signals and slots?

Alan Ezust alan.ezust at gmail.com
Sun Mar 1 04:06:23 GMT 2015


You can only have pyqtSignal() on classes that are derived from QObject.

def Class(QObject):


On Sat, Feb 28, 2015 at 4:48 PM, Jason H <jhihn at gmx.com> wrote:

> 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
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20150228/5c1f37da/attachment.html>


More information about the PyQt mailing list