A sketch of the not so simple proof:
Let $f=u+iv$. Assume $f$ is not constant.
All the points above the real line must have the imaginary part of $f$ with the same sign.
Similarly for the points below.
If $u$ is constant on the real line then $f$ is constant (contradiction).
$v_y=u_x\neq 0$ somewhere on the real line.
So points above the real line must all be of different sign from the points below.
Hence $u_x$ must stay the same sign throughout the real line, and hence $u$ is monotonic on the real line. If $u$ is constant in some interval, then $f$ is constant (contradiction). So $u$ is strictly monotone on the real line.
If $f$ is a polynomial of degree at least 2, then $f$ has at least 2 roots. These roots must all be the same, so we can write $f(z)=c(z-a)^n$ and then either $(z-a)^n=-c^{-1}$ or $(z-a)^n=c^{-1}$ has imaginary solutions (contradiction).
Otherwise, $f(1/z)$ has an essential singularity at 0 and by the great Picard's theorem there are at least two occurrences of some real number not equal to the (possibly) one excluded by Picard's theorem (contradiction).