Example #1
0
after the first Text object. We will set the attribute trim which will allow
this text to be sliced if there isn't enough room.
"""
b = Text('until armageddon strikes the earth', trim=True)

"""
Create the phrase from the Text objects
"""
phrase = Phrase(a, b)

"""
Generate the phrase
"""
print 'No maximum set, generate phrase\n'
print 'expecting:', 'one hour, fourty-five minutes until armageddon strikes the earth'
print 'received: ', phrase.generate()
print '\n'


"""
Select a different delimiter between the Text objects
"""
print 'No maximum length set, generate phrase with ": " as the delimiter\n'
print 'expecting:', 'one hour, fourty-five minutes: until armageddon strikes the earth'
print 'received: ', phrase.generate(delimiter=': ')
print '\n'

"""
Set a maximum length for the message. Birdcage will try to compact the string
gracefully.
"""