[Twisted-Python] win 32 reactor

Gabriel Rossetti mailing_lists at evotex.ch
Mon Mar 31 11:02:12 MDT 2008


Andreas Kostyrka wrote:
> 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
>   
Ok, thanks Andreas, I'll try that.
Gabriel
> 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
>>     
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Twisted-Python mailing list
>> Twisted-Python at twistedmatrix.com
>> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>>     





More information about the Twisted-Python mailing list