Doesn't happen here. Our courts are very formal, judges/lawyers wear the stupid robes and wigs etc.
You have to go to court for a speeding ticket here and like everyone dresses up, suit/tie etc.
Never seen it happen, but I understand coming in dressed incorrectly can get you held in contempt.