Making a dot gradient: Difference between revisions
Jump to navigation
Jump to search
m (Minor update of script) |
m (Added Licence information) |
||
(5 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{Scripting Index}} | |||
This is a script with a couple of loops that will make a dot gradient. Just <b><i>group</i></b> the result and resize to suit. | This is a script with a couple of loops that will make a dot gradient. Just <b><i>group</i></b> the result and resize to suit. | ||
[[Image:DotGradient.png]] | [[Image:DotGradient.png]] | ||
< | <syntaxhighlight lang="python"> | ||
#!/usr/bin/env python | #!/usr/bin/env python | ||
# This program is free software; you can redistribute it and/or modify | |||
# it under the terms of the GNU General Public License as published by | |||
# the Free Software Foundation; either version 2 of the License, or | |||
# (at your option) any later version. | |||
''' | ''' | ||
This script just shows the python syntax for loops and works in 1.3 | This script just shows the python syntax for loops and works in 1.4.3. Uses; | ||
newDocument | |||
createEllipse | createEllipse | ||
setLineWidth | setLineWidth | ||
Line 19: | Line 27: | ||
from scribus import * | from scribus import * | ||
if | if newDocument(PAPER_A4, (10, 10, 10, 10), LANDSCAPE, 1, UNIT_POINTS, NOFACINGPAGES, FIRSTPAGERIGHT, 1): | ||
spx=20 # x co-ord Start point | spx=20 # x co-ord Start point | ||
Line 49: | Line 57: | ||
</ | </syntaxhighlight> |
Latest revision as of 23:43, 9 December 2015
This is a script with a couple of loops that will make a dot gradient. Just group the result and resize to suit.
#!/usr/bin/env python
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
'''
This script just shows the python syntax for loops and works in 1.4.3. 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