Coding for bold text

Dan Bishop danb_83 at yahoo.com
Wed Aug 28 05:21:18 EDT 2002


"a.clarke11" <a.clarke11 at pop.ntlworld.com> wrote in message news:<3D6C0E36.EB8A75AE at pop.ntlworld.com>...
> Hi,
> Does anyone know how I can put code in my (non-tkinter) program that
> changes the interpreter text output to bold setting?
> Can't find this anywhere in the documentation,

If your system has ANSI escape sequences enabled, you can use

def writeBold(text):
   sys.stdout.write("\x1B[1m%s\x1B[0m" % text)

"\x1B[1m" turns bold on and "\x1B[0m" turns it back off.



More information about the Python-list mailing list