Setup:
- Python 3.6
python-pptx
openpyxl
openpyxl-image-loader
My goal:
To extend the Presentation class to include more functions to build unique PPT slides
I do not wish to override any previous __init__()
.
My Progress so far:
I use type()
to see what class I should extend.
from pptx import Presentation
prs=Presentation('template.pptx')
print(type(prs))
>><class 'pptx.presentation.Presentation'>
I then created a new class that inherits pptx.presentation.Presentation
:
class Build_ppt(pptx.presentation.Presentation):
def build_cover(self,i,ws):
#i : index
#ws: is an openpyxl instance
pass
I then try to call the new Build_ppt
class similar to how you would Presentation
:
prs=Build_ppt('template.pptx')
I get the following errors:
TypeError: __init__() missing 1 required positional argument: 'part'
or sometimes it does go through but the super class does not have the proper arguments passed in.