Alan,
On Aug 30, 1:37 pm, Alan Isaac <ais...@america n.eduwrote:
Can someone point me to a simple example
or better yet tutorial for creating
a Powerpoint using Python.
Thanks,
Alan Isaac
You should check our the following for information on using COM
itself:
http://www.oreilly.com/catalog/pytho...pter/ch12.html
Core Python Programming by Chun has an example in it using Tkinter. I
did it a while back, so here's the source:
<code>
# Core Python Chp 23, pg 994
# ppoint.pyw
from Tkinter import Tk
from time import sleep
from tkMessageBox import showwarning
import win32com.client as win32
warn = lambda app: showwarning(app , 'Exit?')
RANGE = range(3, 8)
def ppoint():
app = 'PowerPoint'
ppoint = win32.gencache. EnsureDispatch( '%s.Application ' % app)
pres = ppoint.Presenta tions.Add()
ppoint.Visible = True
s1 = pres.Slides.Add (1, win32.constants .ppLayoutText)
sleep(1)
sla = s1.Shapes[0].TextFrame.Text Range
sla.Text = 'Python-to-%s Demo' % app
sleep(1)
slb = s1.Shapes[1].TextFrame.Text Range
for i in RANGE:
slb.InsertAfter ("Line %d\r\n" % i)
sleep(1)
slb.InsertAfter ("\r\nTh-th-th-that's all folks!\r\n")
warn(app)
pres.Close()
ppoint.Quit()
if __name__ == '__main__':
Tk().withdraw()
ppoint()
</code>
I recommend getting ActiveState's Python distro as it comes with an
IDE that can browse COM objects fairly easily.
Hope that helps!
Mike