[PyQt] PyQt5: Connect/disconnect to/from (non slot) builtin method

Ales Erjavec ales.erjavec324 at gmail.com
Mon Feb 15 09:09:17 GMT 2016


Hello

In PyQt5 (5.5.1) connecting a signal to a builtin method (which is not
defined as a slot)
and then disconnecting it raises a

   TypeError: 'builtin_function_or_method' object is not connected


####

from PyQt5 import QtCore

class Obj(QtCore.QObject):
    signal = QtCore.pyqtSignal(str)

obj = Obj()

obj.signal.connect(obj.setObjectName)
obj.signal.disconnect(obj.setObjectName)  # raises an error

####

The same code works in PyQt4.

AleŇ° Erjavec


More information about the PyQt mailing list