As PyX depends on TeX / LaTeX to create text, the easiest solution will be to convert the string into a form acceptable to TeX / LaTeX. You could define a function to do this.
For me, the following works perfectly:
from pyx import *
def CleanString(s):
s = a.replace("\\",r"\textbackslash ")
s = s.replace("_","\\_")
return s
text.set(mode="latex")
c = canvas.canvas(...
2009-07-02 10:16:24 UTC in PyX