Pour écrire un texte, en position (0,0) dans notre image, puis souligner ce texte...
>>> from pyx import *
>>> c = canvas.canvas()
>>> c.text(0, 0, "Hello, world!")
>>> c.stroke(path.line(0, 0, 2, 0))
>>> c.writeEPSfile("hello")
>>> c.writePDFfile("hello")
Ce qui crée les fichiers hello.eps et hello.pdf dans le répertoire courant. Ces fichiers correspondent à l'image ci-contre :
Vous pouvez les visualiser en tapant dans un terminal :
$ evince hello.pdf