def get_devices(display=None):
_init_directinput()
_devices = []
def _device_enum(device_instance, arg):
device = dinput.IDirectInputDevice8()
_i_dinput.CreateDevice(device_instance.contents.guidInstance, ctypes.byref(device), None)
_devices.append(DirectInputDevice(display, device, device_instance.contents))
print(device_instance.contents.tszProductName, device_instance.contents.guidProduct)
return dinput.DIENUM_CONTINUE
_i_dinput.EnumDevices(dinput.DI8DEVCLASS_ALL, dinput.LPDIENUMDEVICESCALLBACK(_device_enum),
None, dinput.DIEDFL_ATTACHEDONLY)
return _devices
(u'Mouse', GUID(6f1d2b60, d5a0, 11cf, bf, c7, 44, 45, 53, 54, 0, 0))
(u'Keyboard', GUID(6f1d2b61, d5a0, 11cf, bf, c7, 44, 45, 53, 54, 0, 0))
(u'USB 4-Axis 12-Button Gamepad', GUID(1070f30, 0, 0, 0, 0, 50, 49, 44, 56, 49, 44))
[DirectInputDevice(name=Mouse), DirectInputDevice(name=Keyboard), DirectInputDevice(name=USB 4-Axis 12-Button Gamepad)]
>>> pyglet.input.get_devices()Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Python27\lib\site-packages\pyglet\__init__.py", line 357, in __getattr__ __import__(import_name) File "C:\Python27\lib\site-packages\pyglet\input\__init__.py", line 165, in <module> from directinput import get_devices, get_joysticks File "C:\Python27\lib\site-packages\pyglet\input\directinput.py", line 7, in <module> from pyglet.input import baseImportError: cannot import name base>>>
[DirectInputDevice(name=Rato), DirectInputDevice(name=Teclado), DirectInputDevice(name=Trust Keyboard), DirectInputDevice(name=Trust Keyboard), DirectInputDevice(name=Gioteck PS3 Wired Controller)]
--
You received this message because you are subscribed to the Google Groups "pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users...@googlegroups.com.
To post to this group, send email to pyglet...@googlegroups.com.
Visit this group at http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.
"USB 4-Axis 12-Button Gamepad", 300f0701000000000000504944564944
Mapping string: '300f0701000000000000504944564944,USB 4-Axis 12-Button Gamepad,a:b2,b:b1,x:b3,y:b0,back:b8,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a2,lefttrigger:b6,righttrigger:b7,platform:Windows,'
>>> binascii.unhexlify("504944564944")b'PIDVID'
Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win32Type "help", "copyright", "credits" or "license" for more information.>>> import pyglet>>> pyglet.input.get_devices()(u'Rato', GUID(6f1d2b60, d5a0, 11cf, bf, c7, 44, 45, 53, 54, 0, 0))(u'Teclado', GUID(6f1d2b61, d5a0, 11cf, bf, c7, 44, 45, 53, 54, 0, 0))(u'Trust Keyboard', GUID(176145f, 0, 0, 0, 0, 50, 49, 44, 56, 49, 44))(u'Trust Keyboard', GUID(176145f, 0, 0, 0, 0, 50, 49, 44, 56, 49, 44))(u'Gioteck PS3 Wired Controller', GUID(c12125f0, 0, 0, 0, 0, 50, 49, 44, 56, 49, 44))
SDL2 Gamepad Tool v1.1.1 by General Arcade (compiled with SDL version 2.0.3, DLL version 2.0.3)
Website: http://generealarcade.com/gamepadtool/
Searching gamepads...
Found 1 gamepad(s):
"Gioteck PS3 Wired Controller", f02521c1000000000000504944564944
Environment variable "SDL_GAMECONTROLLERCONFIG" is not defined
Checking if new mappings available from github: https://github.com/gabomdq/SDL_GameControllerDB