Difference between revisions of "Elementary Rectangle"

From Scribus Wiki
Jump to: navigation, search
Line 5: Line 5:
 
Introduces: '''CreateRect'''  '''SetFillColor'''  '''SetSetCornerRadius'''. Note that SetCornerRadius is not yet functioning in the script for CreateRect  
 
Introduces: '''CreateRect'''  '''SetFillColor'''  '''SetSetCornerRadius'''. Note that SetCornerRadius is not yet functioning in the script for CreateRect  
  
 
+
<pre><nowiki>
 
+
 
  from scribus import *
 
  from scribus import *
 
  if NewDoc(Paper_A4, (10, 10, 10, 10), Portrait, 1, UNIT_POINTS, NoFacingPages, FirstPageRight):
 
  if NewDoc(Paper_A4, (10, 10, 10, 10), Portrait, 1, UNIT_POINTS, NoFacingPages, FirstPageRight):
Line 26: Line 25:
  
 
       SaveDocAs("Border_2.sla") #Make sure this is writable
 
       SaveDocAs("Border_2.sla") #Make sure this is writable
 +
</nowiki></pre>

Revision as of 08:48, 31 March 2005

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. Note that SetCornerRadius is not yet functioning in the script for CreateRect

 from scribus import *
 if NewDoc(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