[Twisted-Python] win 32 reactor

Andreas Kostyrka andreas at kostyrka.org
Mon Mar 31 12:39:43 EDT 2008


This releases the GIL, so I guess it should be ok to call it in a
background thread from Python. Should be all that is needed.

Andreas

Am Montag, den 31.03.2008, 18:28 +0200 schrieb Gabriel Rossetti:
> 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))==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
> 
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20080331/a761b60a/attachment.pgp 


More information about the Twisted-Python mailing list