Drawing Text

drawBot.text(txt, (x, y))

Draw a text at a provided position.

font("Times-Italic")
text("hallo, I'm Times", (100, 100))
drawBot.textBox(txt, (x, y, w, h), align=None)

Draw a text in a provided rectangle. Optionally an alignment can be set. Possible align values are: “left”, “center” and “right”.

If the text overflows the rectangle, the overflowed text is returned.

The default alignment is left.

x, y, w, h = 100, 100, 256, 174

fill(1, 0, 0)
rect(x, y, w, h)
fill(1)
fontSize(50)
overflow = textBox("hallo, this text is a bit to long",
                (x, y, w, h), align="center")
print overflow

Helpers

drawBot.textSize(txt, align=None)

Returns the size of a text with the current settings, like font, fontSize and lineHeight as a tuple (width, height).

drawBot.installedFonts()

Returns a list of all installed fonts.