Answer the question
In order to leave comments, you need to log in
PyQt4: slots and signals. How to pass a signal from Scrapy to PyQt?
Already asked a question, but ... and did not solve anything. I figured out the signals and slots, but I can’t transfer the information like that. Perhaps because of a different flow (which should not be an obstacle for signals), or perhaps because of crooked hands. I had the following code:
# -*- coding: utf-8 -*-
from PyQt4 import QtCore, QtGui
class SignalClass(QtCore.QObject):
signal = QtCore.pyqtSignal(object)
def __init__(self):
QtCore.QObject.__init__(self)
def send(self, text):
self.signal.emit(text)
# Часть, которая будет выводить текст
@QtCore.pyqtSlot(object)
def output(text):
print text
# Часть, которая будет передавать текст
bag = SignalClass()
bag.signal.connect(output)
bag.send(2) # Тут передаем значение функции output
Answer the question
In order to leave comments, you need to log in
If you have pyqt4 and twisted (used in scrapy) reactors (event loops) running in the same process (but, for example, in different threads), then these reactors will not release the GIL => the application will not work or will work in an unexpected way. There should not be more than one reactor in one Python process.
stackoverflow.com/questions/15087746/qt4reactor-sc...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question