def label_size(self, label):
"""Calculate label size"""
font_family, font_size = self.font
font = Font(family=font_family, size=font_size)
width = 0
lines = 0
for line in label.split('\n'):
width = max(width, font.measure(line))
lines += 1
xscale = turtle.getscreen().xscale
yscale = turtle.getscreen().yscale
return width / xscale, font.metrics('linespace') * lines / yscale
评论列表
文章目录