“Gay marriage ballot measures are not the best measure,” said Patrick J. Egan, a political scientist at New York University who studies issues surrounding gay politicians. “They happen to be about the one issue the public is most uncomfortable with. In a sense, they don’t give us a real good picture of the opinion trend over the last 30 years.”

For instance, the National Opinion Research Center at the University of Chicago has been polling people since 1973 about whether homosexual behavior is morally wrong. In 1973, 73 percent of the people polled described it as always wrong and only 11 percent as “not wrong.” By 2006, those saying homosexuality was “always wrong” had dropped to 56 percent, and 32 percent said it was not wrong.

Image Charles Pugh said his sexuality did not play a role in his race for Detroit’s City Council. Credit... Fabrizio Costantini for The New York Times

One reason for the shift in attitudes, some political scientists contend, is a rising number of gays acknowledging their sexual preference openly in various walks of life, from workers on factory floors to Hollywood stars.

“More and more people have been coming out,” said Sean Theriault, a political scientist at the University of Texas who tracks gay politics. “Ten years ago, you could talk to a lot of people who didn’t know a single gay person, and now, especially in the cities, you would be hard pressed to find someone who doesn’t know anyone who is gay.”

Yet, most of the openly gay politicians who have won races recently have done so by avoiding being labeled as single-issue candidates, several gay politicians said.

In Houston, Ms. Parker never hid her sexual orientation but did not champion gay issues either, focusing instead on municipal concerns like crime, the city budget and drainage. It was a formula that led her to win citywide elections first as an at-large City Council member, then as the controller and, now, as the mayor.