atan2

atan2 converts from (X,Y) coordinates back to angles

Note: it takes arguments in the order Y, X

 
    angle = math.degrees( math.atan2(y,x) )