Difference between revisions of "Elementary Rectangle"
From Scribus Wiki
m (Replaced newDoc with newDocument) |
m (Added licence) |
||
(17 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
− | {{ | + | {{Scripting_Index}} |
− | This | + | <big>This script is <u>specific to A4 paper</u>, you will need to change the '''wth''' and '''dph''' constants for different papers.</big> |
Introduces: '''CreateRect''' '''SetFillColor''' '''SetSetCornerRadius'''. | Introduces: '''CreateRect''' '''SetFillColor''' '''SetSetCornerRadius'''. | ||
− | [[Image:Elementary_rectangle.png| | + | [[Image:Elementary_rectangle.png|frame|200x300px|left|alt=simple rectangle made with scribus python script|Elementary Rectangle generated from python]] |
+ | <!-- clear:both here because image will bleed in to code below --> | ||
+ | <div style="clear: both"></div> | ||
+ | <syntaxhighlight lang="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 draws a black border on A4 and has been tested against 1.3 | + | this script draws a black border on A4 and has been tested against 1.4.3. Calls used in this script are; |
newDocument | newDocument | ||
Line 26: | Line 32: | ||
from scribus import * | from scribus import * | ||
− | if newDocument(PAPER_A4, (10, 10, 10, 10), PORTRAIT, 1, UNIT_POINTS, NOFACINGPAGES, FIRSTPAGERIGHT): | + | if newDocument(PAPER_A4, (10, 10, 10, 10), PORTRAIT, 1, UNIT_POINTS, NOFACINGPAGES, FIRSTPAGERIGHT, 1): |
spx=20 # x co-ord Start point | spx=20 # x co-ord Start point | ||
Line 44: | Line 50: | ||
saveDocAs("Border_2.sla") #Make sure this is writable | saveDocAs("Border_2.sla") #Make sure this is writable | ||
− | + | </syntaxhighlight> | |
− | </ |
Latest revision as of 23:40, 9 December 2015
This script is specific to A4 paper, you will need to change the wth and dph constants for different papers.
Introduces: CreateRect SetFillColor SetSetCornerRadius.
#!/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 draws a black border on A4 and has been tested against 1.4.3. Calls used in this script are;
newDocument
createRect
setCornerRadius
setLineWidth
setFillColor
setLineColor
saveDocAs
"""
from scribus import *
if newDocument(PAPER_A4, (10, 10, 10, 10), PORTRAIT, 1, UNIT_POINTS, NOFACINGPAGES, FIRSTPAGERIGHT, 1):
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