multiple mice

Is it possible to have several mice running at once? One mouse for input for one object/character and another for a different one? These days with multiple USB connections, it’s possible to add quite a few mice. Would you have to use ptgame and somehow fake the second mouse as being a joystick?

I know this is a sort of weird question, but I’m in the middle of hoping to tear apart several mice to make an unusual input device.


Most of what you will probably have to deal with is making sure your operating system conveys the mice as separate input devices. I have had 2 mice hooked up and they both were treated as the same thing by more than just panda. Once you can make sure you have separate input for both mice, it shouldn’t be hard.

The GraphicsWindow class, instanced by, has some functions that should handle what you are asking for:

if you run a check on your input devices, keyboard/mouse shows up as a single device. This will have the input device index for your first mouse. If you did things properly, you should be able to access additional mice (or any other input device) with a different index.

basically, getPointer(i) tells you whether the i-th input device has a mouse (really any screen-space pointer device)

I now know that I have two mice and that “1” is the device number for my second mouse. I’m now trying to figure out how to get the X and Y position of it. I can’t use the base.mouseWatcherNode.getMouse, and I can’t figure out how Panda wants me to reference devices to get this info. I currently have two joysticks hooked up, but I’m using Pygame for them and I can use
mpos3 = pygame.joystick.Joystick(0).get_axis(0)
to get X and Y axis information, but I checked into Pygame and they don’t seem to have any multiple mouse configurations either.

I’m not really a programmer, so some of this goes over my head even though the anwer is probably simplistic.


Sorry, that should have read “hasPointer(i)”. getPointer gives you the actual data of the mouse input. Thats what you want to use.

data = []
for i in range(
        md =

When you are first experimenting with it, you could hard-code the device index into getPointer() to make sure its the right input device.

Here’s how it works under windows. (None of this is implemented under Linux yet).

Pointer 0 is the “system mouse”.
Pointer 1 is the first “raw mouse”.
Pointer 2 is the second “raw mouse”.

Under windows, the “system mouse” is controlled by all the physical mice. Each raw mouse is only affected by one physical mouse. Unlike the system mouse, raw mouse coordinates are not limited to the area of the desktop - for example, the X coordinate will just keep increasing as long as you keep sliding the mouse right. They can even go negative. Unlike the system mouse, the raw mouse coordinates are reported even if the mouse pointer is way outside the window.

If I use getPointer(0), I get the current mosue coordinates, no matter which mouse I use. (as Josh stated). I have 3 pointer devices…2 mice and one wacom tablet (not trying to use it for this eperiment). If I print out the valies for getPointer(1), getPointer(2), or getPonter(3), I only get zeroes when I change any of my pointer devices.

To prove I have pointers I use this code…

numpoints = 
print numpoints, " Number of Pointers"

for j in range(numpoints):
  print j
  print, " Name of device"
  print, " Pointer"

It tells me I have pointers 0 to 3 with some number for X,Y values for 0, and 0s for the X,Y values of the other 3

To look at the data as I’m moving the mice I use the following…

def CubeMove(self, task):
#Check to make sure the mouse is readable
MX1 =
MY1 =
print MX1, " X axis"
print MY1, " Y axis"

return Task.cont                        #Task continues infinitely

I have this currently set to looked at pointer1, but I get 0,0 for my return values where as if I cahnge it to 0, I’ll get the mouse coordinates no matter ehich mouse I use.

Is there some way to initialize the mice? Is it possible that my OS ()Win XP) is not seeing them as separate devices even though it will tell me that I have two mice working.

Any other suggestions?



As for the mouse discussion… I can’t help there… but I have read now several times that there are handling differences (commands that do only work in windows or linux)… wouldn’t it be better to have all features for both platforms available? For example (as shown here): A program is written to use two mice under windows. If you don’t know that (and most ppl won’t) that this is a “windows-only” feature, they would start bitching why it doesn’t work @ other platforms, which is sad because I thought that one of the most positive aspects is that it IS available for more than just the Windows Platform…

Regards, a wonderin Bigfoot29

windsor: you are absolutely right. You need to set up your mice outside of panda such that they register as two separate devices. This has to do with your computers configuration, so I wouldn’t be able to help you there. You may need 3rd party software.

I have had two separate mice and they both acted as device 0. I never actually looked into how to create separate mouse input.