## Predefined Constants

There are some Constants defined to help using the Commands:

#### Scribus Version:

The script interface provides two variables containing the current Scribus version in the `scribus` module. Scripts can use these variables to check that they're running under the version of Scribus they expect, and to report information about incompatibilities to the user. These two variables, `scribus_version` and `scribus_version_info`, were added in 1.2.1 and 1.3.0svn and will not be present in earlier versions. If you need to, you can check for their presence with `hasattr(scribus, 'scribus_version')`.

`scribus_version` contains the current Scribus version as a string. It will usually look like `'1.2.1svn'` or `'1.3.0'`, for example, but is not guaranteed to always follow that format. This variable is useful when you need to display the version to the user, for example when reporting an incompatibility. Do not parse or compare this variable, that is what `scribus_version_info` is for.

`scribus_version_info` is a tuple similar to the `sys.version_info` tuple provided by Python. It is a tuple of the form (majorversion, minorversion, patchlevel, extraversion, build) for example, 1.2.1svn will have `(1,2,1,'svn',0)` and 1.3.2 will have `(1,3,2,'',0)` . These tuples are ideal for checking for minimum versions, etc, because Python compares tuples element-by-element, left-to-right. For example:

    if scribus.scribus_version_info[:3] < (1,2,2):
        messageBox("Scribus - Python script",
            "This script requires Scribus 1.2.2 or newer. "+"You're running %s." % scribus.scribus_version, scribus.ICON_CRITICAL)
        sys.exit()

Note that if you are using this style of import statement:

    import scribus

you will need to add a prefix to these predefined constants, for example, scribus.ICON_CRITICAL.

#### Unit Enumeration Constants:

UNIT_POINTS
  Measurement Unit Point = 0
UNIT_MILLIMETERS
  Measurement Unit Millimeter = 1
UNIT_INCHES
  Measurement Unit Inch = 2
UNIT_PICAS
  Measurement Unit Pica = 3

#### Unit Conversion Constants

These conversion factors can be used to convert units to and from points. Thus, to convert inches to points, you can simply write 'value/inch', to convert points to inches you write 'value*inch', and to convert inches to mm you write 'value*mm/inch' .

pt
  points in 1 pt
inch
  inches in 1 pt
p
  pica in 1 pt
cm
  centimetres in 1 pt
mm
  millimetres in 1 pt
...
  Other constants will be provided if the Scribus core knows about them.

#### Page Orientation Definitions:

PORTRAIT
  Page orientation Portrait = 0
LANDSCAPE
  Page orientation Landscape = 1

#### Definitions for Page Formats:

If you are using these, it's important to understand that these constants are simply tuples of these specific numbers. There are now two sets of these constants for A and B series of paper formats.

The original set, such as PAPER_A4, is used when a document is created with points units. Now you can also use the similarly named PAPER_A4_MM when you are using millimeters as the page units. As before, they must be used with the appropriate constant, either UNIT_POINTS or UNIT_MILLIMETERS. What you can then do, for example, is use them to create a document in points, then switch the units of the document with the setUnit() command.

PAPER_A0
  Paper format A0 = 2380 x 3368 Points
PAPER_A1
  Paper format A1 = 1684 x 2380 Points
PAPER_A2
  Paper format A2 = 1190 x 1684 Points
PAPER_A3
  Paper format A3 = 842 x 1190 Points
PAPER_A4
  Paper format A4 = 595 x 842 Points
PAPER_A5
  Paper format A5 = 421 x 595 Points
PAPER_A6
  Paper format A6 = 297 x 421 Points
PAPER_A7
  Paper format A7 = 210 x 297 Points
PAPER_A8
  Paper format A8 = 148 x 210 Points
PAPER_A9
  Paper format A9 = 105 x 148 Points

PAPER_A0_MM
  Paper format A0 = 841 x 1189 Millimeters
PAPER_A1_MM
  Paper format A1 = 594 x 841 Millimeters
PAPER_A2_MM
  Paper format A2 = 420 x 594 Millimeters
PAPER_A3_MM
  Paper format A3 = 297 x 420 Millimeters
PAPER_A4_MM
  Paper format A4 = 210 x 297 Millimeters
PAPER_A5_MM
  Paper format A5 = 148 x 210 Millimeters
PAPER_A6_MM
  Paper format A6 = 105 x 148 Millimeters
PAPER_A7_MM
  Paper format A7 = 74 x 105 Millimeters
PAPER_A8_MM
  Paper format A8 = 52 x 74 Millimeters
PAPER_A9_MM
  Paper format A9 = 37 x 52 Millimeters

PAPER_B0
  Paper format B0 = 2836 x 4008 Points
PAPER_B1
  Paper format B1 = 2004 x 2836 Points
PAPER_B2
  Paper format B2 = 1418 x 2004 Points
PAPER_B3
  Paper format B3 = 1002 x 1418 Points
PAPER_B4
  Paper format B4 = 709 x 1002 Points
PAPER_B5
  Paper format B5 = 501 x 709 Points
PAPER_B6
  Paper format B6 = 355 x 501 Points
PAPER_B7
  Paper format B7 = 250 x 355 Points
PAPER_B8
  Paper format B8 = 178 x 250 Points
PAPER_B9
  Paper format B9 = 125 x 178 Points
PAPER_B10
  Paper format B10 = 89 x 125 Points

PAPER_B0_MM
  Paper format B0 = 1000 x 1414 Millimeters
PAPER_B1_MM
  Paper format B1 = 707 x 1000 Millimeters
PAPER_B2_MM
  Paper format B2 = 500 x 707 Millimeters
PAPER_B3_MM
  Paper format B3 = 353 x 500 Millimeters
PAPER_B4_MM
  Paper format B4 = 250 x 353 Millimeters
PAPER_B5_MM
  Paper format B5 = 176 x 250 Millimeters
PAPER_B6_MM
  Paper format B6 = 125 x 176 Millimeters
PAPER_B7_MM
  Paper format B7 = 88 x 125 Millimeters
PAPER_B8_MM
  Paper format B8 = 62 x 88 Millimeters
PAPER_B9_MM
  Paper format B9 = 44 x 62 Millimeters
PAPER_B10_MM
  Paper format B10 = 31 x 44 Millimeters

PAPER_C5E
  Paper format C5E = 462 x 649 Points
PAPER_COMM10E
  Paper format Comm10E = 298 x 683 Points
PAPER_DLE
  Paper format DLE = 312 x 624 Points
PAPER_EXECUTIVE
  Paper format Executive = 542 x 720 Points
PAPER_FOLIO
  Paper format Folio = 595 x 935 Points
PAPER_LEDGER
  Paper format Ledger = 1224 x 792 Points
PAPER_LEGAL
  Paper format Legal = 612 x 1008 Points
PAPER_LETTER
  Paper format Letter = 612 x 792 Points
PAPER_TABLOID
  Paper format Tabloid = 792 x 1224 Points

#### Definitions for Document Layout:

FACINGPAGES
  Layout with facing Pages.
NOFACINGPAGES
  Normal Layout of the Document.
FIRSTPAGELEFT
  The first Page of the Document is a left Page.
FIRSTPAGERIGHT
  The first Page of the Document is a right Page.

#### Alignment Definitions:

ALIGN_LEFT
  Text is aligned to the Left.
ALIGN_CENTERED
  The Text is centered in the Textframe.
ALIGN_RIGHT
  The Text is aligned to the Right Side of the Textframe
ALIGN_FORCED
  The Text has forced Alignment
ALIGN_BLOCK
  The Text has block Alignment

#### Vertical alignment Definitions:

ALIGNV_TOP
  Text is aligned vertically to the top.
ALIGNV_CENTERED
  Text is aligned vertically to the center.
ALIGNV_BOTTOM
  Text is aligned vertically to the bottom.

#### Line related Definitions:

LINE_DASH
LINE_DASHDOT
LINE_DASHDOTDOT
LINE_DOT
LINE_SOLID

JOIN_BEVEL
JOIN_MITTER
JOIN_ROUND

CAP_FLAT
CAP_ROUND
CAP_SQUARE

#### Fill related Definitions:

FILL_NOG
  No gradient, plain color
FILL_HORIZONTALG
FILL_VERTICALG
FILL_DIAGONALG
FILL_CROSSDIAGONALG
FILL_RADIALG

#### Dialog Buttons

Button Type | Return Value
BUTTON_ABORT | 262144
BUTTON_CANCEL | 4194304
BUTTON_IGNORE | 1048576
BUTTON_NO | 65536
BUTTON_NONE | N/A
BUTTON_OK | 1024
BUTTON_RETRY | 524288
BUTTON_YES | 16384

There is also a hierarchy of buttons in terms of how they appear in the dialogs, with this ordering, left to right:

BUTTON_YES, BUTTON_NO, BUTTON_OK, BUTTON_RETRY, BUTTON_IGNORE, BUTTON_ABORT, BUTTON_CANCEL

For example, even if you assign CANCEL to button1, RETRY to button2, and YES to button3, they will appear YES, RETRY, and CANCEL left to right in the dialog.

#### Dialog Icons

ICON_CRITICAL
ICON_INFORMATION
ICON_NONE
ICON_WARNING