[Scribus] I need a lot of colored rectangles.

Owen rcook
Tue Apr 15 04:29:17 CEST 2008


> On Mon, 14 Apr 2008, Thomas Zastrow wrote:
>>
>> I'm not sure if I understood you correctly, but why aren't you use the
>> Scribus gradient function? It's a task of seconds to produce a gradient
>> like your example with 3 colors in Scribus. Here's a try:
>
> I'm trying not to use an actual gradient, but rather a series of
> 168 single-color, one-point rectangles, with a one-point
> whitespace between them.  And each rectangle has a different
> color.
>
> No matter how I do this, it's going to be difficult, but if I can
> make it so that I just have to change one value, repeatedly,
> without switching back and forth from the mouse, I'm sure I can
> do it.
>
> The other suggestion of editing the .sla file by hand is
> appealing, too.
>

The script below produces 336 rectangles, black then white giving a gray
effect

If you have a list of colours, then perhaps it is not too difficult to use
that list in lieu of the black entries


Owen



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=1           # rectangle width in points
      dph=20          # Depth of frame - adjust to suit
      b="Black"       # add other colors as required
      b1="Blue"
      w="White"


      for i in range(0,168):
          spx=spx+2
          h = createRect(spx,spy,wth,dph)
          setLineWidth(0, h)
          setFillColor(b, h)
          setLineColor(b, h)
      spx=21

      for i in range(0,168):
          spx=spx+2
          h = createRect(spx,spy,wth,dph)
          setLineWidth(0, h)
          setFillColor(w, h)
          setLineColor(b, h)

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




More information about the scribus mailing list