Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python-pptx - Changing auto shape border color

Tags:

python-pptx

I am trying to add a colour to the border of a rectangular auto shape that I have created as below. The default colour seems to be blue but I am not sure how could I modify that to a custom color.

shapes = slide.shapes
left = top = width = height = Inches(1.0)
shape = shapes.add_shape(
MSO_SHAPE.ROUNDED_RECTANGLE, left, top, width, height)

fill = shape.fill
fill.solid()
fill.fore_color.rgb = RGBColor(255, 255, 255)

slide.shapes._spTree.remove(shape._element)
slide.shapes._spTree.insert(2, shape._element)
like image 903
scott martin Avatar asked Sep 13 '19 09:09

scott martin


1 Answers

Figured out how to change the auto shape border color using the below:

line = shape.line
line.color.rgb = RGBColor(255, 0, 0)
like image 195
scott martin Avatar answered Jan 04 '23 01:01

scott martin