title: How do I add a shadow to AutoShapes using Python-pptx?
body: <p>I just want to <strong>add a shadow</strong> to the shapes that I am creating while using <strong>python-pptx</strong>.
  I have read as many documents about using shadows in python-pptx as I can find but I can not figure out how to actually do it.</p>
  
  <p>I tried <code>shadow = shape.shadow</code> to create a 'ShadowFormat' object but when I try to do <code>shadow.visible</code> I get the error <code>AttributeError: 'ShadowFormat' object has no attribute 'visible'</code></p>
  
  <p>If anyone could explain how this is done and give <strong>an example</strong> it would be much appreciated!</p>
  
  <p>Extra info:</p>
  
  <p>This is the page linking to the topic: <a href="https://python-pptx.readthedocs.io/en/latest/dev/analysis/shp-shadow.html" rel="nofollow noreferrer">https://python-pptx.readthedocs.io/en/latest/dev/analysis/shp-shadow.html</a> however there is no example on how to create a shadow for a shape in powerpoint.
  I have imported the following modules: </p>
  
  <pre><code>from pptx import Presentation
  from pptx.enum.shapes import MSO_SHAPE
  from pptx.enum.action import PP_ACTION
  from pptx.util import Cm
  from pptx.enum.dml import MSO_THEME_COLOR_INDEX
  from pptx.enum.text import MSO_AUTO_SIZE
  from pptx.util import Pt
  </code></pre>
  
  <p>I am using python-pptx v0.6.18 and python v3.8</p>
  
  <p><strong>Edit</strong></p>
  
  <p>Example that creates the shape but no shadow appears:</p>
  
  <pre><code>#Import modules
  from pptx import Presentation
  from pptx.enum.shapes import MSO_SHAPE
  from pptx.util import Cm
  from pptx.enum.dml import MSO_THEME_COLOR_INDEX
  from pptx.util import Pt
  
  
  #Open powerpoint file
  prs = Presentation('filename.pptx')
  
  #Create a slide
  slidelayout = prs.slide_layouts[0]
  slide = prs.slides.add_slide(slidelayout)
  shapes = slide.shapes
  
  #Add a shape
  shape = shapes.add_shape(MSO_SHAPE.ROUNDED_RECTANGLE, Cm(10), Cm(10), Cm(10), Cm(10))
  
  #Create a shadow
  shadow = shape.shadow
  shadow.inherit = False
  shadow.visible = True
  shadow.distance = Pt(10)
  shadow.shadow_type = 'outer'
  shadow.angle = 45
  shadow.blur_radius = Pt(5)
  shadow.color = MSO_THEME_COLOR_INDEX.ACCENT_5
  shadow.transparency = '50'
  shadow.distance = Pt(5)
  shape.shadow.style = 'outer'
  
  #Save the powerpoint file
  prs.save('filename2.pptx')
  </code></pre>
  
  <p>Example that creates the error message:</p>
  
  <pre><code>#Import modules
  from pptx import Presentation
  from pptx.enum.shapes import MSO_SHAPE
  from pptx.util import Cm
  from pptx.enum.dml import MSO_THEME_COLOR_INDEX
  from pptx.util import Pt
  
  
  #Open powerpoint file
  prs = Presentation('filename.pptx')
  
  #Create a slide
  slidelayout = prs.slide_layouts[0]
  slide = prs.slides.add_slide(slidelayout)
  shapes = slide.shapes
  
  #Add a shape
  shape = shapes.add_shape(MSO_SHAPE.ROUNDED_RECTANGLE, Cm(10), Cm(10), Cm(10), Cm(10))
  
  #Create a shadow
  shadow = shape.shadow
  shadow.visible
  
  
  #Save the powerpoint file
  prs.save('filename2.pptx')
  </code></pre>