In public schools in the US, textbooks are provided free of charge to the students, but they must return them at the end of each school year. It's something of a "last day of school" ritual for everyone to turn in their textbooks (or pay for them if they've lost them or damaged them). In this case, Bart was trying to score "extra points" with his teacher by turning in his books in pristine condition. Of course, if he had been doing his school work properly all year, the book wouldn't look "new" or be in its original wrapper. The implication is that Bart never used his textbooks.
"Short pants" was just a slang nickname the teacher came up with on the spot because Bart always wears those shorts. She was sort of insulting him because he had given her that outrageous and obviously insincere compliment (comparing her to an angel) in an effort to get better grades.