Modify angles through mouse position

Hi,
I’m new here and just trying to create something in Blender with Python
unfortunately it does not work and I do not see the error.

could someone help me with a hint?



import bge
import Rasterizer
import math

cont = bge.logic.getCurrentController()
obj = cont.owner

StartA = owner.localOrientation.to_euler()
bge.current_angle = round(math.degrees(StartW[0]))

SRuder = 45  #Left/Right angel
HRuder = 45  #Up/Down angel

mouse = cont.sensors["Mouse"]
RLeftRight = bge.render.getWindowWidth() / SRuder # radius Left / Right
RUpDown = bge.render.getWindowHeight() / HRuder # radius Up / Down 


Rasterizer.showMouse(1)

# Transform the mouse coordinates to see how far the mouse has moved.
def mousePos():
   x = (bge.render.getWindowWidth() / 2 - mouse.position[0])/ RLeftRight
   y = (bge.render.getWindowHeight() / 2 - mouse.position[1])/ RUpDown
   return (x, y)
pos = mousePos()

# Up/ Down / modify angles through mouse position 
if Mouse.positive:
    NeuR = math.radians(pos[0])
    StartA[0] = NeuR
    owner.localOrientation = StartA.to_matrix()