Auto completion not working very well for python-pptx
Hi,
I am doing my first steps with the python-pptx lib.
Thing is, that it is very hard to focus on programming, since code-completion is not working as expected. Maybe I have a wrong understanding, so here is my case:
from pptx import Presentation
from pptx.presentation import Presentation as P
from pptx.shapes.autoshape import Shape
from pptx.slide import Slides
from pptx.enum.shapes import MSO_AUTO_SHAPE_TYPE
from pptx.util import Cm
prs: P = Presentation()
slide_layout = prs.slide_layouts[1]
slides: Slides = prs.slides
slides.add_slide(slide_layout)
slide = prs.slides[0]
shapes = slide.shapes
left = top = width = height = Cm(2.0)
shape : Shape = shapes.add_shape(
MSO_AUTO_SHAPE_TYPE.ROUNDED_RECTANGLE, left, top, width, height
)
line = shape.line
As you can see, I created a variable called "line", which is instanciated with "shape.line". When I now try to access to my line-variable via code-completion, no object specific members, functions or anything else are listed (but the default methods link __init__ etc).
So I looked into the sourcecode and found this:
@lazyproperty
def line(self):
return LineFormat(self)
Ok - there is an decorator set, which shows me, that "line" should be handled as a property (like I did - without braces).
PyCharm actually tells me, that the return value of that property/method is a LineFormat instance.
Now comes the hard part: if PyCharm knows the return value (and can resolve it) - why isn't there a list of members etc when typing this:
line.
Does anyone knows something about this ?
Thank a lot!
Please sign in to leave a comment.