gpt4 book ai didi

python - 我们从 prs.slides[4].shapes[3].width 得到的数字的单位是什么,其中 prs 是 python-pptx 中的演示对象?

转载 作者:行者123 更新时间:2023-12-01 08:10:17 25 4
gpt4 key购买 nike

从 prs.slides[4].shapes[3].width 得到的数字的单位是什么,其中 prs 是 python-pptx 中的演示对象?在帮助中,它说“英制公制单位”,但我得到的数字与此不符。

最佳答案

英制公制单位 (EMU) 是 1/914400 英寸,由 Microsoft 选择(或可能发明),因为它允许将图形对象(形状)的位置和大小指定为整数 (因此避免浮点计算,可能主要与性能相关),同时仍然允许英寸(英制)和米(公制)距离表示为精确整数。

914400的因数很多,但肯定包括25.4(每英寸为毫米)、72(每英寸为点数);所有 2、4、8、16 和 32(所有常见的小数英寸)和 100(因此小数英寸到美国英语 PowerPoint UI 中常见的 0.01 英寸分辨率。

通常,形状距离属性(左、上、宽、高)返回的对象是具有属性 .inchesEmu 对象的子类, .pts.cm.mm 将为您转换为 float 常用测量单位。所以类似:

>>> shape.width.cm
2.54
>>> shape.width.inches
1.0
>>> shape.width.pts
72.0

关于python - 我们从 prs.slides[4].shapes[3].width 得到的数字的单位是什么,其中 prs 是 python-pptx 中的演示对象?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55295964/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com