Ejemplo n.º 1
0
 def init_mice(self, init_pos=(0,0)):
     n = manymouse.init()
     self.mice = []
     
     if n == 0:
         print 'No mice detected!'
     else:
         for i in range(n):
             name = manymouse.device_name(i)
             mouse = Mouse(i, name, init_pos)
             self.mice.append(mouse)
             print '#%s: %s' % (i, name)
Ejemplo n.º 2
0
    def init_mice(self, init_pos=(0, 0)):
        n = manymouse.init()
        self.mice = []

        if n == 0:
            print "No mice detected!"
        else:
            for i in range(n):
                name = manymouse.device_name(i)
                mouse = Mouse(i, name, init_pos)
                self.mice.append(mouse)
                print "#%s: %s" % (i, name)
Ejemplo n.º 3
0
def init_mice(screen_w, screen_h):
    global available_mice, mice
    available_mice = min(manymouse.init(), MAX_MICE)
    mice = []
    
    if available_mice == 0:
        print 'No mice detected!'
    else:
        for i in range(available_mice):
            name = manymouse.device_name(i)
            mouse = Mouse(screen_w/2, screen_h/2, tuple(random.randint(0,255) for x in range(3)))
            mouse.name = name
            mouse.connected = True
            mice.append(mouse)            
            print '#%s: %s' % (i, mice[i].name)
Ejemplo n.º 4
0
def main():
  n = manymouse.init()
  event = manymouse.Event()
  while True:
    if manymouse.poll_event(event) == 0:
      continue
    if event.type == manymouse.EVENT_RELMOTION:
      print event.device, 'EVENT_RELMOTION', event.item, event.value, event.minval, event.maxval
    elif event.type == manymouse.EVENT_ABSMOTION:
      print event.device, 'EVENT_ABSMOTION', event.item, event.value, event.minval, event.maxval
    elif event.type == manymouse.EVENT_BUTTON: 
      print event.device, 'EVENT_BUTTON', event.item, event.value, event.minval, event.maxval
    elif event.type == manymouse.EVENT_SCROLL:
      print event.device, 'EVENT_SCROLL', event.item, event.value, event.minval, event.maxval
    elif event.type == manymouse.EVENT_DISCONNECT:
      print event.device, 'EVENT_DISCONNECT', event.item, event.value, event.minval, event.maxval
Ejemplo n.º 5
0
def init_mice(screen_w, screen_h):
    global available_mice, mice
    available_mice = min(manymouse.init(), MAX_MICE)
    mice = []

    if available_mice == 0:
        print 'No mice detected!'
    else:
        for i in range(available_mice):
            name = manymouse.device_name(i)
            mouse = Mouse(screen_w / 2, screen_h / 2,
                          tuple(random.randint(0, 255) for x in range(3)))
            mouse.name = name
            mouse.connected = True
            mice.append(mouse)
            print '#%s: %s' % (i, mice[i].name)