[go: up one dir, main page]

Menu

[r18]: / examples / encode.py  Maximize  Restore  History

Download this file

40 lines (30 with data), 1.2 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python
""" Simple script showing how to use the python-mms library to encode a simple
MMS message consisting of 3 "pages", or slides, using only 2 classes from the
"mms" module.
This will create the MMS message, and save it in a file called "sample.mms" in
the current directory.
@author: Francois Aucamp <faucamp@csir.co.za>
@license: GNU LGPL
"""
# import the python-mms library
import mms
if __name__ == '__main__':
# First, we create the pages...
slide1 = mms.MMSMessagePage()
slide1.addImage('content/pymms.jpg')
slide1.addText('This is the first slide, with a static image and some text.')
slide2 = mms.MMSMessagePage()
slide2.setDuration(4500)
slide2.addImage('content/smile.jpg', 1500)
slide2.addText('This second slide has some timing effects.', 500, 3500)
slide3 = mms.MMSMessagePage()
slide3.addText('And now, a text-only slide. The end.')
# ...then create the message and add the pages...
message = mms.MMSMessage()
message.headers['Subject'] = 'Test MMS'
message.addPage(slide1)
message.addPage(slide2)
message.addPage(slide3)
# ...and finally, save the message to disk
message.toFile('sample.mms')