Spectrum of idempotent element
The following argument works for any idempotent (not necessarily a projection, i.e., not necessarily selfadjoint).
Suppose that $\lambda\not\in\{0,1\}$. Then $$a(a-\lambda)=a^2-\lambda a=a-\lambda a=(1-\lambda)a. $$ Similarly, $$ (1-a)(a-\lambda)=(1-a)a-(1-a)\lambda=-(1-a)\lambda. $$ Let $$b=\frac1{1-\lambda}\,a-\frac1\lambda\,(1-a).$$ Then $$ b(a-\lambda)=ba-\lambda b=\frac1{1-\lambda}\,a-\frac\lambda{1-\lambda}\,a+1-a=1, $$ and one can also check that $(a-\lambda)b=1$. So $a-\lambda$ is invertible, which shows that $\lambda\not\in\sigma(a)$.
Let's consider $f(x)=x-x^{2}$ and $a^{2}=a$, then since polynomials preserve the spectrum, $f(\sigma(a))=\sigma(f(a)) = \sigma(0) = 0$, so $f(\sigma(a))=0$, then $\sigma(a) = \{0, 1 \}$