Proof of continuous function of a compact set is uniformly continuous. I want to proof:

If $X$ is compact, $Y$ is another metric space, and $f:X\to Y$ is a continuous function. Then $f$ is uniformly continuous.

I know this is a well-known statement,but the book wants me use the Lebesgue covering lemma to complete the proof:

If $X$ is compact and $\mathcal{G}$ is an open cover of $X$, then there is an $r>0$ such that for each $x\in X$ there is a $G \in\mathcal{G}$ such that $B(x,r)\subset G$.

I have no idea that how the 'open cover' in this lemma helps in the proof of the statement above.How can I get further? Any help and hints will be appreciated!
Best regards!
 A: I am giving the same proof which is given in Baby rudin also
Given that $$f: (X,d_X)\to(Y,d_Y)$$
be a continous map with $X$ is compact set
By compactness of X we can find for each open cover of $x$ there is finite subcover
So let $\{V_\alpha\}_{\alpha\in I}$ be an open cover for X then
$$X\subset \bigcup_{i=1}^nV_{\alpha_i}$$
for $\alpha_i\in I$ and $i=1,2,3,\dots n$
Now for each $p\in X$ and with continuity of $f$ we can say
for some $q\in X$, $d_X(p,q)<\Phi(p)$ $\implies d_Y(f(p),f(q))<\frac{\epsilon}{2}$,
Here $\epsilon>0$
Now define $J_p=\left\{q:\; d_X(p,q)<\frac{\Phi(p)}{2}\right\}$ Since $J_p$ is open and it covers X so it must have finite subcover  by compactness of X
Hence $$X\subset\bigcup_{i=1}^mJ_{p_i}$$
define $\delta=\frac{1}{2}\min\left\{\Phi(p_1),\Phi(p_2),\dots \Phi(p_m)\right\}$
Here Our $\delta$ is independent of any point of $X$
here our half job is done
Now we came into intersting part of our solutions
pick $p,q\in X$ such that $d_X(p,q)<\delta$
here our $q$ will be in some $J_{p_k}$ So $d_X(q,p_{k})<\frac{\Phi(p_k)}{2}$
and $d_X(p,p_k)\leq d_X(p,q)+d_X(q,p_k)<\delta+\frac{\Phi(p_k)}{2}<\Phi(p_k)$
Hence $$d_Y(f(p),f(q))\leq d_Y(f(p),f(p_k))+d_Y(f(p_k),f(q))<\epsilon$$
we are done
