Invert Joystick Direction

Hi, I have a task that involves a joystick and uses PsychoPy3, Pyglet and Python 2.7.3 on Mac and I would like the joystick direction to be inverted. Specifically, right now, when the joystick is pulled towards me, the cursor on the screen moves up, instead of down.

Is there code or a setting I can use to reverse this?
This is the code I have for the joystick:

JOYSTICK OPTION

def probe(self,trial):
    clock = core.Clock()
    joysticks = pyglet.input.get_joysticks()
    assert joysticks, 'No joystick device is connected'
    j = joysticks[0] #we are going to name our joystick j 
    j.open()
    flipCount = -1
    starttime = clock.getTime()
    while True:
            elapsed = clock.getTime()-starttime
            if elapsed>2.8:
                break #exit out of this loop, because they are out of time  
            j.close() #have to do this for this pyglet joystick to work 
            j.open()
            self.dis.fixation.draw()
            self.dis.probe.pos = (j.x*700,j.y*700) # this may need to be adjusted for full screen
            self.dis.probe.draw()
            self.dis.win.flip()

thank you!

Hi @Brain_Base, have you thought about using Builder to create your experiment? Using the Builder joystick, inverting the y-axis would be simple. You could assign your joystick positions to a cursor created with a text stim (’+’), and modify the y-axis position value of the text stim with [joystick.getX(), joystick.getY() * -1]. Multiplying your axis by -1 inverts the movement.

Hi @dvbridges–would you be able to provide an example of how to use the joystick option in Builder? I have not been able to figure it out and get it to work within builder…ex: I would like to move an image around the screen using the joystick.