Side lobes not visible in FFT of rect function
You have to imagine your signal as being periodically extended forever in both directions. Since you square window is constant over the whole interval when it is periodically extended it becomes flat everywhere. In other words, you don't have a square window. You just have a flat line. That's why only the zero frequency band on the fft has any amplitude. Try doing it again with some zeros on either side of your square window.