[PyQt] How to connect the activated signal of QWinEventNotifier to a custom slot in pyqt 5.6

slepton at posteo.de slepton at posteo.de
Mon Jan 30 23:19:45 GMT 2017


 

Hello,

I am trying to use QWinEventNotifier on PyQt 5.6 / Python 3.5 with a
custom slot. My Problem is, that I can't figure out what decorator to
use.

The relevant code snippet looks like this: 

def register(self):
 # Windows event
 self.receive_event = win32event.CreateEvent(None, 0, 0, None)
 # Code to register the event with the PCAN API
 # ...
 self.PCANrevieceEventHandler = QWinEventNotifier(parent=self)

self.PCANrevieceEventHandler.setHandle(ctypes.c_int(self.receive_event))
 self.PCANrevieceEventHandler.activated.connect(self.msg_recev)

@pyqtSlot( ) # I tried int, ctypes.c_int, ... nothing 
def msg_recev(self, handle):
 # read the buffer

I get TypeError: connect() failed between activated(Qt::HANDLE) and
unislot() 

I know, that in Qt 5.8 there would be QtSerialBus to propperly handle
this, looking at the Qt src, QWinEventNotifier seems to be the right
thing to use... 

What is the propper way to do this? 

Best regards

Sebastian
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20170131/c67aaa37/attachment.html>


More information about the PyQt mailing list