Hello,
I need to use PyHook, a win32 lib allowing global input monitoring
(mouse, keyboard, etc). It uses the PyWin32 extentions, in particular
win32com's PumpMessages() function. This is an event loop defined like so :
// @pymethod |pythoncom|PumpMessages|Pumps all messages for the current
thread until a WM_QUIT message.
static PyObject *pythoncom_PumpMessages(PyObject *self, PyObject *args)
{
MSG msg;
int rc;
Py_BEGIN_ALLOW_THREADS
while ((rc=GetMessage(&msg, 0, 0, 0))…
[View More]==1) {
TranslateMessage(&msg); // needed?
DispatchMessage(&msg);
}
Py_END_ALLOW_THREADS
if (rc==-1)
return PyWin_SetAPIError("GetMessage");
Py_INCREF(Py_None);
return Py_None;
}
my question is ho can I make this work with twisted? Is there a way to
use the supplied win32 reactors (there are three I think) or do I have
to write one myself? Could someone please point me in the right direction?
Thanks,
Gabriel
[View Less]
Hi,
I expected reactor.connectTCP to return a deferred. That would have been
nice, since callbacks would have handled the outcome.
So how to I handle failure with it?
I tried:
from twisted.internet.error import ConnectionRefusedError
print "Connecting..."
try:
reactor.connectTCP(self.server, self.port, self.f)
except ConnectionRefusedError(reason):
self.Connect_Failure()
return
self.Connect_Success()
No good. What am I …
[View More]missing?
Thank you!
Simon
--
Linux user #458601 - http://counter.li.org.
[View Less]