Why any other element except fluorine wouldn't take electrons from oxygen?

My teacher said that fluorine is more electronegative than oxygen thus it will take electrons of oxygen. 


But now, why won't other Group 17 elements, like chlorine, bromine, iodine, would take electrons from oxygen? They too have just 7 electrons in their valence shells.


Technically, they should but yet they have lesser electronegativity and this is something that I'm not able to digest. 




You can consider thinking about charge to volume density. Fluorine is very small and has highest charge to volume ratio among other group 17 elements. For that reason only fluorine is able to snatch electrons from oxygen. 


 1

There are two simple ways to calculate charges on atoms which can be done by hand.


The first relies on the concept of *oxidation numbers*. To define these, draw the Lewis structure of a target molecule/ion and *break all covalent bonds by transferring both electrons in the bond to the more electronegative atom* (usually based on the Pauling scale of electronegativity). In this sense, by definition oxygen only presents a positive charge when either an electron is directly removed from oxygen, or when it shares a bond with fluorine. There are relatively few examples of this, as $\ce{O-F}$ bonds are weak and oxygen atoms are hard to ionize. Examples of molecules with $\ce{O-F}$ bonds and positive oxidation number on the oxygen atom are [$\ce{OF2}$](http://en.wikipedia.org/wiki/Oxygen_difluoride) (+2) and [$\ce{O2F2}$](http://en.wikipedia.org/wiki/Dioxygen_difluoride) (+1). An interesting example of oxygen with positive oxidation number happens in the dioxygenyl cation, [$\ce{O2^{+}}$](http://en.wikipedia.org/wiki/Dioxygenyl) (+0.5 on both atoms), which is quite difficult to produce except upon reaction with highly fluorinated substances such as $\ce{PtF5}$ or $\ce{AsF5}$. These are actually avid enough for electrons that they tear one off the neutral dioxygen molecule $\ce{O2}$, producing the ionic salts $\ce{O2^+[PtF5]^{-}}$ and $\ce{O2^+[AsF5]^{-}}$, among others. The sum of all oxidation numbers in a molecule/ion must equal its net charge.


The second way to calculate charges relies on the concept of *formal charges*. To find these, draw the Lewis structure of a target molecule/ion and *break all covalent bonds right in the middle, transferring one electron to each of the bonding atoms, regardless of electronegativity*. This definition does not rely on electronegativity, so as one might suspect, it is much more common for oxygen to present a positive formal charge. Simple examples (all of the following with a positive formal charge of +1) include the hydronium cation $\ce{H3O^+}$, trialkyloxonium cations such as trimethyloxonium [$\ce{(CH3)3O^+}$](http://en.wikipedia.org/wiki/Trimethyloxonium_tetrafluoroborate), the **central** oxygen atom in ozone [$\ce{O3}$](http://en.wikipedia.org/wiki/Ozone), and [pyrylium aromatic rings](http://en.wikipedia.org/wiki/Pyrylium_salt), the last of which are found in many natural compounds. The sum of all formal charges in a molecule/ion must also equal its net charge.


(A more pictorial explanation for the ways to calculate oxidation numbers and formal charges can be found in [this Wikipedia article](http://en.wikipedia.org/wiki/Formal_charge#Formal_charge_compared_to_oxidation_state))


So, which of these two concepts is correct? In reality, *neither*. They're both extremes of a scale, and reality often sits somewhere in the middle. Both are meant more as a bookkeeping mechanism to keep track of the total charge in an ion/molecule, and provide some qualitative idea of where electrons might be more concentrated or sparse. Attempts at determining precise atomic charges rely on complicated calculations in computational chemistry. These calculations need not agree (and most often do not agree) with either of the values given by oxidation numbers or formal charges, and the actual charges can be represented by any real number, rarely being an integer or a simple fraction. 


In light of this, let's look at your claim. You suggest that fluorine takes electrons from oxygen while other halogens don't. Let us take the two simple examples $\ce{OF2}$ and $\ce{Cl2O}$. These are both gasses at room temperature, which suggests bonding in these substances is not predominantly ionic, so no atom abstracts electrons completely from any other; *instead they share their electrons*. Thus, they are well-described by considering the oxygen and halogen atoms are covalently bound into a molecule much like water, except with halogen atoms in place of hydrogen atoms. Applying the concept of oxidation numbers, the oxygen atom in $\ce{OF2}$ has an oxidation number of +2 as stated previously, while in $\ce{Cl2O}$ the oxygen has an oxidation number of -2. Applying the concept of formal charges, we find that the formal charge on the oxygen atom is exactly zero in both molecules. Neither concept is correct, so we expect reality to be something in between. Exactly what the charge is, we don't know without resorting to computer calculations, though it is probably quite safe to say at least that the oxygen atom is more deficient in electron density in $\ce{OF2}$ than in $\ce{Cl2O}$.


 1