Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

To control the rounded angle of ROUNDED_RECTANGLE, python + pptx

When adding a ROUNDED_RECTANGLE on slides, by using pptx, I have below lines and a slide generated.

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')

If it's manual, the rounded angle can be adjusted (where the red arrow pointing).

Is there a way to control it from the script? Thank you.

enter image description here

like image 350
Mark K Avatar asked Apr 16 '26 02:04

Mark K


1 Answers

Shapes like this have one or more .Adjustments properties.

You need to modify .Adjustments(1) which can take values between 0 and 1 as I recall. A value of .5, for example, will move the yellow adjustment diamond .5 of the distance between the corner and the midpoint of the shape.

like image 198
Steve Rindsberg Avatar answered Apr 17 '26 15:04

Steve Rindsberg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!