How would I prove this?
Write $\displaystyle f(x+iy) = u(x,y) + iv(x,y)$.
We know that $\displaystyle v(x,y)=0$ by hypothesis.
But, $\displaystyle u_x = v_y \implies u_x = 0 \implies u(x,y) = g(y)$.
And, $\displaystyle u_y = -v_x \implies u_y = 0 \implies u(x,y) = h(x)$.
Therefore, $\displaystyle g,h$ need to be constant functions.
And so $\displaystyle u(x,y) = c$.