I can't give you a reliable method for getting the pencil in Fancy Pants, as I don't have a verified answer for it—and I'd rather not make something up.
Your best bet is to check a Fancy Pants walkthrough or fan forum, where players who've found it can describe exactly what to do. These community guides tend to have the accurate, tested steps.