Speaking at Barclays Center in Brooklyn on Thursday, not far from her presidential campaign headquarters, Hillary Clinton did not beat around the bush.

“I wish I had flown in from the White House,” she told graduates of Medgar Evers College, a Brooklyn school that is part of the City University of New York. “But I’m just as happy to be here anyway.”

It was the only explicit reference to Washington in her 20-minute address, though the commencement coincided with dramatic events unfolding there that day: James B. Comey, the former F.B.I. director, was testifying before the Senate Intelligence Committee.

Her speech, however, was still pointedly political. Acknowledging the diversity of the Medgar Evers student body and of Brooklyn, Mrs. Clinton called on graduates to uphold the legacy of figures like the slain civil rights leader for whom the school is named, by fighting for voting rights and standing up against the rise of hate crimes.