Beispiel #1
0
    def _mouse_callback(self, x, y, button, modifiers, event_time):
        # check the mouse and time (if this is needed)
        buttons = val(self.buttons)
        correct_resp = val(self.correct_resp)
        button_str = mouse.buttons_string(button)
        if None in buttons or button_str in buttons:
            # it's all good!, so save it
            self.pressed = button_str
            self.press_time = event_time

            # fill the base time val
            self.base_time = val(self.base_time_src)
            if self.base_time is None:
                # set it to the state time
                self.base_time = self.state_time
            
            # calc RT if something pressed
            self.rt = event_time['time']-self.base_time

            if self.pressed in correct_resp:
                self.correct = True

            # let's leave b/c we're all done
            #self.interval = 0
            self.leave()
Beispiel #2
0
def onDrag(x,y,button):
    if active == True:
        match mouse.buttons_string(button):
            case "LEFT":
                fakeline.x2 = x
                fakeline.y2 = y
            case _:
                pass
Beispiel #3
0
def onRelease(x,y,button, cursor,window):
    if active == True:
        match mouse.buttons_string(button):
            case "LEFT":
                window.set_mouse_cursor(cursor)
                lines["line{0}".format(len(lines))] = [linex,liney,x,y,"blank"]
            case _:
                pass
Beispiel #4
0
def onClick(x,y,button, cursor,window):
    if active == True:
        match mouse.buttons_string(button):
            case "LEFT":
                window.set_mouse_cursor(cursor)
                global linex,liney
                linex = x
                liney = y
                fakeline.x = x
                fakeline.y = y
                fakeline.x2 = x
                fakeline.y2 = y
            case _:
                pass
Beispiel #5
0
 def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
     print(
         'on_mouse_drag(x=%d, y=%d, dx=%d, dy=%d, buttons=%s, modifiers=%s)'
         % (x, y, dx, dy, mouse.buttons_string(buttons),
            key.modifiers_string(modifiers)),
         file=self.file)
Beispiel #6
0
 def on_mouse_release(self, x, y, button, modifiers):
     print('on_mouse_release(x=%d, y=%d, button=%r, modifiers=%s)' %
           (x, y, mouse.buttons_string(button),
            key.modifiers_string(modifiers)),
           file=self.file)
Beispiel #7
0
 def on_mouse_release(self, x, y, button, modifiers):
     print('on_mouse_release(x=%d, y=%d, button=%r, '\
                         'modifiers=%s)' % (x, y, 
         mouse.buttons_string(button), key.modifiers_string(modifiers)), file=self.file)
Beispiel #8
0
 def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
     print('on_mouse_drag(x=%d, y=%d, dx=%d, dy=%d, '\
                         'buttons=%s, modifiers=%s)' % (
           x, y, dx, dy,
           mouse.buttons_string(buttons), key.modifiers_string(modifiers)), file=self.file)
Beispiel #9
0
 def __str__(self):
     return mouse.buttons_string(self._buttons)
Beispiel #10
0
 def on_mouse_press(self, x, y, button, modifiers):
     print >> self.file, 'on_mouse_press(x=%d, y=%d, button=%r, '\
                         'modifiers=%s)' % (x, y,
         mouse.buttons_string(button), key.modifiers_string(modifiers))
Beispiel #11
0
 def on_mouse_press(self, x, y, button, modifiers):
     print >> self.file, 'on_mouse_press(x=%d, y=%d, button=%r, '\
                         'modifiers=%s)' % (x, y,
         mouse.buttons_string(button), key.modifiers_string(modifiers))
Beispiel #12
0
 def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
     print "on_mouse_release(x={}, y={}, dx={}, dy={}, button={}, modifiers={})".format(
         x, y, dx, dy, mouse.buttons_string(buttons),
         key.modifiers_string(modifiers))
Beispiel #13
0
 def on_mouse_press(self, x, y, button, modifiers):
     print "on_mouse_press(x={}, y={}, button={}, modifiers={})".format(
         x, y, mouse.buttons_string(button),
         key.modifiers_string(modifiers))