So my code is:
from pptx import Presentation
prs = Presentation('template.pptx')
title_slide_layout = prs.slide_layouts[0]
slide = prs.slides.add_slide(title_slide_layout)
title = slide.shapes.title
subtitle = slide.placeholders[1]
title.text = "Python 3.6 - Turtle Race"
subtitle.text = "Data Analytics&Visualization with random generated data"
for placeholder in prs.slide_layouts[4].placeholders:
print('%d %s' % (placeholder.placeholder_format.idx, placeholder.name))
slide = prs.slides.add_slide(prs.slide_layouts[4])
littleTitle = slide.placeholders[1]
littleTitle.text('Comparison of Winning times and pieces of wins')
prs.save("visualiztaion.pptx")
My output is(with the error):
0 Title 1
1 Text Placeholder 2
2 Content Placeholder 3
3 Text Placeholder 4
4 Content Placeholder 5
10 Date Placeholder 6
11 Footer Placeholder 7
12 Slide Number Placeholder 8
Traceback (most recent call last):
File "D:/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!_!Piton/turtleRace/presentationMaker.py", line 34, in <module>
littleTitle.text('Comparison of Winning times and pieces of wins')
TypeError: 'str' object is not callable
Process finished with exit code 1
You can see I have every recommended file in the project and if you want to I can send a picture of my project interpreter.
So my question is basically just how can I insert text into 0 Title 1
and into 1 Text Placeholder 2
.
So mostly I just want to solve and pass the error, because I have to make this code works.
So please help me out.