4

Does anyone know how to use the Raw Input facility on Windows from a WX Python application?

What I need to do is be able to differentiate the input from multiple keyboards. So if there is another way to achieving that, that would work too.

derfred
  • 18,881
  • 3
  • 23
  • 25

3 Answers3

4

Have you tried using ctypes?

>>> import ctypes
>>> ctypes.windll.user32.RegisterRawInputDevices
<_FuncPtr object at 0x01FCFDC8>

It would be a little work setting up the Python version of the necessary structures, but you may be able to query the Win32 API directly this way without going through wxPython.

joeforker
  • 40,459
  • 37
  • 151
  • 246
3

Theres a nice looking library here http://code.google.com/p/pymultimouse/

It's not wx-python specific - but it does use raw input in python with ctypes (and worked in my test with 2 mice)

0

I've wrapped the win32 calls and put together a small Python package to hook into raw input events.

import winrawin
winrawin.hook_raw_input_for_window(hwid, process_event_fn)
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/34851897) – doneforaiur Aug 19 '23 at 04:16