小编mor*_*air的帖子

aiohttp web.response body as json

我对HTTP服务器aiohttp.如何web.Response()通过JSON(来自a dict)返回?

async def api_server(request):
    res = {"q": "qqq", "a": "aaa"}
    return web.Response(res) # <-- as JSON
Run Code Online (Sandbox Code Playgroud)

python json python-3.x aiohttp

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

如何在Python Pillow中设置字体的字距调整?

对于 Pillow 类ImageDrawhttps://pillow.readthedocs.io/en/stable/reference/ImageDraw.html#PIL.ImageDraw.PIL.ImageDraw.ImageDraw.text)我找到了 param features。它可以调整此字体参数:https://learn.microsoft.com/en-us/typography/opentype/spec/featurelist

如何设置字距调整(kern)参数?我不知道语法。

这不是工作:

draw.text((61, 386), text, (0, 0, 0), font=font, features={"kern": 1.0})
Run Code Online (Sandbox Code Playgroud)

python python-imaging-library

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