  We prove a sharp upper bound on convex domains, in terms of the diameter
alone, of the best constant in a class of weighted Poincar\'e inequalities. The
key point is the study of an optimal weighted Wirtinger inequality.
