Emma Thompson’s adaptation of Christianna Brands’s children’s books, about a nanny who magically transforms a family of unruly children into more responsible types by teaching them important life lessons, is a delightful surprise–perhaps the best film of its kind since “Babe.” That’s not because it contains anthropomorphized animals–though in one memorable scene, though not one of its most noteworthy, it does (a dancing donkey in women’s clothes). It’s simply because it’s visually witty and almost unfailingly charming, even when at the close it resorts to that old silent-movie chestnut, the pie fight, for a properly energetic denouement.

In addition to writing the script, Thompson also proves wonderfully droll as McPhee, a stern woman with a grotesque snaggletooth and several huge moles who claims to have been sent by the government to the rambling home of dotty mortician–and widower–Mr . Brown (Colin Firth, in full exasperated mode) after his seven unruly children have driven away their seventeenth nanny. She moves about silently, appears when least expected (usually saying to the surprised person she confronts, “I did knock”–a good running gag, later taken up by a different character), and carries a large stick with obvious powers attached. In short order she uses her special abilities to teach the kids–led by the eldest boy, Simon (Thomas Sangster)–a series of lessons, starting from easy ones like when to go to bed, when to arise and how to dress properly and moving to more profound issues of responsibility. She also aids in keeping the family together in the face of threats from rich Aunt Adelaide (Angela Lansbury), who threatens to cut off her donations to the clan unless Brown remarries–a possibility that compels him to consider wedding a recent customer, the flamboyant and strident Widow Quickly (Celia Imrie), even though the sweet housemaid Evangeline (Kelly Macdonald) is obviously smitten with him (and he with her). And hovering in the background but occasionally bursting into the forefront are the family’s harried ex-military cook (Imelda Staunton) and Brown’s Tweedledum and Tweedledee assistants Wheen and Jowls (Derek Jacobi and Patrick Barlow)–three characters who almost seem to have stepped out of the pages of Lewis Carroll.

Under the dextrous hand of director Kirk Jones (“Waking Ned Devine”), who beautifully judges how to mix whimsy, slapstick and quirkiness, the supporting cast all have a great time. Lansbury plays the old dowager with the proper degree of archness, and Staunton gets the brusque bearing of the cook exactly right. Imrie carries off Quickly’s extravagance nicely, making the woman both repellent and absurd, while Jacobi and Barlow prove a pairing made in heaven as the staffers who find it amusing to pop up out of coffins as a joke. Remarkably in a picture like this, the children are very pleasant too, though some of their shenanigans tend to go on a bit long. Sangster manages to convey Simon’s precociousness but catches his serious side, too, and his younger colleagues–all the way down to Baby Agatha (Hebe and Zinnia Barnes)–have their moments, especially Raphael Coleman as the bespectacled science buff Eric.

But what really takes the movie to a higher level of joyousness is the astonishingly colorful production design by Michael Howells, art direction by Lynne Huitson and Matt Robinson, set decoration by Philippa Hart and costume design by Nic Ede. The eye-catching, magically artificial look is expertly captured in Henry Braham’s lustrous cinematography; few films since “The Wizard of Oz” have managed this sort of candy-colored appearance so well. Mention should also be made of the crisp editing of Justin Krish and Nick Moore, which brings the picture in at a spiffy 98 minutes; the appropriately homely effects supervised by Mark Holt; and Patrick Doyle’s charmingly supportive score.

What Nanny McPhee tells the Brown children early on is that when they want her to leave, she’ll stay, but when they want her to stay, she’ll leave. It’s a lesson that might be applied to the movie itself. You might initially be reluctant to go to a picture about an English nanny that threatens to be a “Mary Poppins” without the music, just as you probably were when you first heard about a picture about a talking piglet. But by the time “Nanny McPhee” is over, you’ll probably be sorry the movie is coming to an end–just as you were to see Babe leave the screen. This should become a family perennial.