Not all, but some species of flies can be deterred by hanging bunches of sharp-smelling, aromatic herbs or placing them on the windowsill.
This includes:
rosemary
Garden rue
thyme
mint
Tansy
Horehound
If you take a branch of each of these plants, they work well against annoying flies.