P.C.
My three year old daughter was also going through that. It was especially embarrassing when she did this at the grocery store. What I have done now is time out with her nose on any available wall, irregardless of where we are. She stays with her nose on the wall until she can behave. I actually ask her if she is ready to behave and if she responds with no, her nose remains on the wall. So the length of time for time out is determined by her. It is embarrassing for her to have to do this in front of anyone and it is very effective when we are in public.