Roughly approximate the width of a string of text in Python?

前端 未结 3 709
误落风尘
误落风尘 2021-01-12 16:34

How would one, using Python, approximate the font width of a given string of text?

I am looking for a function with a prototype similar to:

def getA         


        
3条回答
  •  半阙折子戏
    2021-01-12 16:55

    I have used a library that does this however it requires pygame: http://inside.catlin.edu/site/compsci/ics/python/graphics.py Look under sizeString

提交回复
热议问题