| 409 | | def paint_background(colour): |
|---|
| 410 | | global poster |
|---|
| 411 | | poster.setFillColor(getattr(colors,colour)) |
|---|
| 412 | | poster.rect(0,0,poster._pagesize[0],poster._pagesize[1],fill=1) |
|---|
| 413 | | poster.setFillColor(colors.white) |
|---|
| | 409 | def paint_background(background, photo_credit=None): |
|---|
| | 410 | global poster |
|---|
| | 411 | try: # first assume it is a colour |
|---|
| | 412 | poster.setFillColor(getattr(colors,background)) |
|---|
| | 413 | poster.rect(0,0,poster._pagesize[0],poster._pagesize[1],fill=1,stroke=0) |
|---|
| | 414 | poster.setFillColor(colors.white) |
|---|
| | 415 | except AttributeError: |
|---|
| | 416 | # now assume it is an image |
|---|
| | 417 | img = Image(background, width=poster._pagesize[0], height=poster._pagesize[1]) |
|---|
| | 418 | img.drawOn(poster,0,0) |
|---|
| | 419 | if photo_credit: |
|---|
| | 420 | poster.saveState() |
|---|
| | 421 | poster.translate(poster._pagesize[0],0) |
|---|
| | 422 | poster.rotate(90.0) |
|---|
| | 423 | poster.setFont("Helvetica-Bold", 24) |
|---|
| | 424 | poster.drawString(10,10,photo_credit) |
|---|
| | 425 | poster.restoreState() |
|---|
| 510 | | paint_background('oldlace') |
|---|
| | 522 | poster.setFillColor(colors.white) |
|---|
| | 523 | #poster.setStrokeColor(colors.white) |
|---|
| | 524 | |
|---|
| | 525 | paint_background('white') #'seagreen' 'whitesmoke' 'oldlace |
|---|
| | 526 | |
|---|
| | 527 | #paint_background('flickr_fortinbras_10182754_cfc533d350.jpg', photo_credit="Background image: 'Pine bough', from http://www.flickr.com/photos/fortinbras") |
|---|
| | 528 | |
|---|
| | 529 | #paint_background('flickr_blmurch_144285136_a7116060ed_o.jpg', photo_credit="Background image: 'Pine cones' by Beatrice Murch (http://www.flickr.com/people/blmurch/)") |
|---|
| | 530 | |
|---|
| | 531 | #paint_background('flickr_blmurch_384758012_cab7208c79_o.jpg', photo_credit="Background image: 'Pine cones on the ceiling' by Beatrice Murch (http://www.flickr.com/people/blmurch/") |
|---|