You haven't provided an SSCCE, so I'm only guessing. You can't "remove" something from being painted. You can, however, surround it with an if statement and toggle whether it's painted or not.