Spread cardoons in a shallow baking dish about 9 inches in diameter or of a size to fit the vegetable fairly snugly.
Stew onions in butter in a heavy skillet, covered, over very low heat until extremely soft (but not browned), about 25 minutes, stirring occasionally. Raise heat slightly, add flour and stir 2-3 minutes.