代码

import pptx

# 新建ppt
from pptx.util import Pt, Inches

ppt = pptx.Presentation()
# 所有的版式
layouts = ppt.slide_layouts
# 创建一个页面
sheet = ppt.slides.add_slide(layouts[1])
# 占位符
h1 = sheet.shapes.placeholders[0]
h1.text = '标题'

h2 = sheet.shapes.placeholders[1]

# 占位符中的段落
p = h2.text_frame.add_paragraph()
p.text = '第一段落'

p = h2.text_frame.add_paragraph()
p.level = 2
p.text = '第二段落'

# 图片插入
img_path = '1724a51964ed5bda.png'
left, top, width, height = Inches(1), Inches(1), Inches(5), Inches(5)
sheet.shapes.add_picture(img_path, left, top, width, height)

# p.font.bold = True
# p.font.italic = True
p.font.size = Pt(36)
print(type(p.font))

from pptx.text.text import Font

# 保存
ppt.save('myppt2.pptx')

效果

pptx模块的图片框_pptx