python - 控制ROUNDED_RECTANGLE的圆角角度,python + pptx

标签 python powerpoint python-pptx

当使用 pptx 在幻灯片上添加 ROUNDED_RECTANGLE 时,我生成了以下几行并生成了一张幻灯片。

from pptx import Presentation
from pptx.enum.shapes import MSO_SHAPE
from pptx.util import Inches

prs = Presentation()
title_only_slide_layout = prs.slide_layouts[0]
slide = prs.slides.add_slide(title_only_slide_layout)
shapes = slide.shapes

shape = shapes.add_shape(MSO_SHAPE.ROUNDED_RECTANGLE, Inches(1), Inches(0.5), Inches(8), Inches(2))

prs.save('c:\\PPT\\round rectangle.pptx')

如果是手动的,则可以调整圆角(红色箭头所指的位置)。

有没有办法通过脚本来控制它?谢谢。

enter image description here

最佳答案

像这样的形状具有一个或多个 .Adjustments 属性。

您需要修改 .Adjustments(1),我记得它可以采用 0 到 1 之间的值。例如,值为 0.5 时,黄色调整菱形将移动形状的角点和中点之间的距离 0.5。

关于python - 控制ROUNDED_RECTANGLE的圆角角度,python + pptx,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51871163/

相关文章:

python - 如何在Jupyter中使用pandas的 `to_latex`方法获取可以直接在LaTeX中使用的代码?

python - zip 不适用于 imshow : TypeError: Image data cannot be converted to float

c# - 是否有可能插入新的 Slide Master?

python-pptx - 使用已知幻灯片索引和 shape_id 替换图表中的数据

python - python-pptx 制作的演示文稿中的字体大小

python - 如何使用python-pptx选择保存目录?

python - 在 python 中将图像转换为字符串后存档图像

python - 从不同目录实例化Python子类

Excel 范围到 PowerPoint - 粘贴问题

python - Django/Python : How to convert pptx/docx formats to PDF using python?