Making a dot gradient

From Scribus Wiki
Revision as of 09:27, 21 March 2011 by Owencook (talk | contribs) (Updated newDocument to take 8 arguments)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
This article is part of the Scripts series.

This is a script with a couple of loops that will make a dot gradient. Just group the result and resize to suit.

DotGradient.png

#!/usr/bin/env python

'''
This script just shows the python syntax for loops and works in 1.3.5.  Uses;

newDocument
createEllipse
setLineWidth
setFillColor
setFillShade
saveDocAs
'''

from scribus import *

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

      spx=20          # x co-ord Start point
      spy=20          # y co-ord Start point
      width=4	      # first circle diameter
      

      b="Black"       # add other colors as required
      b1="Blue"
      w="White"
      
      for j in range(0,4):
          for i in range(0,30):


              c = createEllipse(spx, spy+50, width, width)
              setLineWidth(0, c)
              setFillColor(b1, c)
              setFillShade(40 + 2*i,c)
              spx=spx+20
              spy=spy-0.5
              width=width + 1
     
          spy=spy+40
          width=4
          spx=20

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