Difference between revisions of "Elementary Rectangle"

From Scribus Wiki
Jump to: navigation, search
m (Added image)
m (Replaced newDoc with newDocument)
Line 15: Line 15:
 
this script draws a black border on A4 and has been tested against 1.3.5.  Calls used in this script are;
 
this script draws a black border on A4 and has been tested against 1.3.5.  Calls used in this script are;
  
newDoc
+
newDocument
 
createRect
 
createRect
 
setCornerRadius
 
setCornerRadius
Line 26: Line 26:
 
from scribus import *
 
from scribus import *
  
if newDoc(PAPER_A4, (10, 10, 10, 10), PORTRAIT, 1, UNIT_POINTS, NOFACINGPAGES, FIRSTPAGERIGHT):
+
if newDocument(PAPER_A4, (10, 10, 10, 10), PORTRAIT, 1, UNIT_POINTS, NOFACINGPAGES, FIRSTPAGERIGHT):
  
 
       spx=20          # x co-ord Start point
 
       spx=20          # x co-ord Start point

Revision as of 23:07, 9 December 2010

This article is part of the Scripts series.

This one is specific to A4 paper, you will need to change the wth and dph constants for different papers.

Introduces: CreateRect SetFillColor SetSetCornerRadius.

300



#!/usr/bin/env python

"""
this script draws a black border on A4 and has been tested against 1.3.5.  Calls used in this script are;

newDocument
createRect
setCornerRadius
setLineWidth
setFillColor
setLineColor
saveDocAs
 
"""
from scribus import *

if newDocument(PAPER_A4, (10, 10, 10, 10), PORTRAIT, 1, UNIT_POINTS, NOFACINGPAGES, FIRSTPAGERIGHT):

      spx=20          # x co-ord Start point
      spy=20          # y co-ord Start point
      wth=595         # A4 width in points
      dph=842         # Depth of frame - adjust to suit
      a=8             # Line width
      b="Black"       # add other colors as required
      b1="Blue"
      w="White"

      h = createRect(spx,spy,wth-2*spx,dph-2*spy)
      setCornerRadius(20, h)
      setLineWidth(8, h)
      setFillColor(w, h)
      setLineColor(b, h)

      saveDocAs("Border_2.sla") #Make sure this is writable