Breaking/Wrapping lines "automatically"

Fredrik Lundh fredrik at
Thu Mar 23 14:50:21 CET 2006

Jorge Godoy wrote:
> Is there something I can do in PIL to restrict a line to a certain size and
> have it to break/wrap into a newline automatically?  (Or by using some
> code, of course...)

there's no standard function for this purpose, no.

here's a somewhat rough implementation, based on a WCK demo:

a somewhat better approach would be to use collect words as long as
they fit, and write each line as a single string.


More information about the Python-list mailing list