Write escape sequences without using subshell

Drop invoking 'printf' command, use sys.stdout.write instead.

BTW, it's also bugfix. I had a strange issue with original code: string with escape sequences was just visibly printed, and so background wasn't changed. Replacing of '\e' with '\033' in printf arguments helped.