[Scribus] help need taking first steps in scripting

Gregory Pittman gpittman
Sun Apr 2 23:56:47 CEST 2006


Ananga ---- Antony Brand wrote:
> Hi Craig and anyone else who may be able to help me!
>
> I've put a some commands into a file called "my first python.py" and 
> it's not producing any image.
> I am aiming for one horizontal and one vertical line roughly in the 
> middle of the (landscape) page both 4cm long.
>
> To give the context of my endeavour I am hoping to use Scribus to make 
> an animated flickerbook of hypercubes 
> (http://en.wikipedia.org/wiki/Tessaract) and transformations of its 
> subcubes for a course I'm teaching early in May, so these are my first 
> steps drawing the edges of squares.
>
> I'm using the "execute script" command in the "script" menu
>
> START OF FILE "my first python.py"
>
> #!/usr/bin/env python
>     # -*- coding: latin-1 -*-
>
> xalong , yalong = 29.7/2.0 , 21.0/2.0
> cubelength = 4
>
> createLine( xalong , yalong , xalong+cubelength , yalong , "line1")
> selectObject("line1")
> setLineCap(CAP_ROUND,"line1")
> setLineWidth(10,"line1")
Some other points:
selectObject() is unnecessary in your brief program.
The createLine command should have a form something like:

a = createLine(xalong, yalong, xalong+cubelength, yalong, "line1")
# createLine will "return" a value, so it needs a variable name to 
return it to.
# That way you can then just immediately afterward put:
setLineCap(CAP_ROUND, a)
# and
setLineWidth(10, a)
setLineColor("Black", a) # probably a good idea too, or whatever color 
you wish.

The "line1" is actually optional too -- a name for the object will be 
assigned by Scribus.

Greg



More information about the scribus mailing list