相关疑难解决方法(0)

使用PIL使用回车写入文本在Python中返回到图像

我有一个python脚本,使用PIL将文本写入图像.这一切都很好,除非我遇到带有回车符的字符串.我需要在文本中保留回车符.而不是将回车写入图像,我得到一个小盒子字符,返回应该是.以下是编写文本的代码:

<code>
 draw = ImageDraw.Draw(blankTemplate)
 draw.text((35 + attSpacing, 570),str(attText),fill=0,font=attFont)
</code>
Run Code Online (Sandbox Code Playgroud)

attText是我遇到麻烦的变量.我在写它之前将它转换为字符串,因为在某些情况下它是一个数字.

谢谢你的帮助.

python text image python-imaging-library

1
推荐指数
1
解决办法
2547
查看次数

标签 统计

image ×1

python ×1

python-imaging-library ×1

text ×1