home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 November / CPNL0711.ISO / beeld / teken / scribus-1.3.3.9-win32-install.exe / share / samples / 3columnA4.py next >
Text File  |  2006-10-29  |  2KB  |  54 lines

  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3.  
  4. """ Creates 3 column layout on A4 paper and save it under 3columnA4.sla filename. This is a simple way to demonstrate creating a doc on the fly. """
  5.  
  6. try:
  7.     # Please do not use 'from scribus import *' . If you must use a 'from import',
  8.     # Do so _after_ the 'import scribus' and only import the names you need, such
  9.     # as commonly used constants.
  10.     import scribus
  11. except ImportError,err:
  12.     print "This Python script is written for the Scribus scripting interface."
  13.     print "It can only be run from within Scribus."
  14.     sys.exit(1)
  15.  
  16. def main(argv):
  17.     """This is a simple way to demonstrate creating a doc on the fly. """
  18.  
  19.     pass    # <--- Delete this line
  20. #########################
  21. # YOUR IMPORTS GO HERE  #
  22. #########################
  23.  
  24. import sys
  25.  
  26. try:
  27.     from scribus import *
  28. except ImportError:
  29.     print "This script only runs from within Scribus."
  30.     sys.exit(1)
  31.  
  32. margins = (50, 50, 50, 50)
  33. size = (612, 792)
  34.  
  35. def main():
  36.     if newDocument(PAPER_A4, margins, LANDSCAPE, 1, UNIT_POINTS, NOFACINGPAGES, FIRSTPAGELEFT,1):
  37.         a = createText(50, 50, 230, 495)
  38.         setTextAlignment(1,a)
  39.         setText("Column A", a)
  40.         setFontSize(12, a)
  41.         b = createText(280, 50, 230, 495)
  42.         setTextAlignment(1,b)
  43.         setText("Column B", b)
  44.         setFontSize(12, b)
  45.         c = createText(510, 50, 230, 495)
  46.         setTextAlignment(1,b)
  47.         setText("Column C", c)
  48.         setFontSize(12, c)
  49.         saveDocAs("3columnA4.sla")
  50.         
  51.  
  52. if __name__ == '__main__':
  53.     main()
  54.