## Python: module scribus

# Scribus Python interface module

This module is the Python interface for Scribus. It provides functions to control scribus and to manipulate objects on the canvas. Each function is documented individually below. A few things are common across most of the interface. Most functions operate on frames. Frames are identified by their name, a string - they are not real Python objects. Many functions take an optional (non-keyword) parameter, a frame name. Many exceptions are also common across most functions. These are not currently documented in the docstring for each function.

- Many functions will raise a NoDocOpenError if you try to use them without a document to operate on.
- If you do not pass a frame name to a function that requires one, the function will use the currently selected frame, if any, or raise a NoValidObjectError if it can't find anything to operate on.
- Many functions will raise WrongFrameTypeError if you try to use them on a frame type that they do not make sense with. For example, setting the text colour on a graphics frame doesn't make sense, and will result in this exception being raised.
- Errors resulting from calls to the underlying Python API will be passed through unaltered. As such, the list of exceptions thrown by any function as provided here and in its docstring is incomplete.

Details of what exceptions each function may throw are provided on the function's documentation.

### Modules

#### Classes

- exceptions.Exception
  - ScribusException
  - NameExistsError
  - NoDocOpenError
  - NoValidObjectError
  - NotFoundError
  - WrongFrameTypeError

class NameExistsError(ScribusException)
Method resolution order: NameExistsError ScribusException exceptions.Exception
Methods inherited from exceptions.Exception: __getitem__(...) __init__(...) __str__(...)

class NoDocOpenError(ScribusException)
Method resolution order: NoDocOpenError ScribusException exceptions.Exception
Methods inherited from exceptions.Exception: __getitem__(...) __init__(...) __str__(...)

class NoValidObjectError(ScribusException)
Method resolution order: NoValidObjectError ScribusException exceptions.Exception
Methods inherited from exceptions.Exception: __getitem__(...) __init__(...) __str__(...)

class NotFoundError(ScribusException)
Method resolution order: NotFoundError ScribusException exceptions.Exception
Methods inherited from exceptions.Exception: __getitem__(...) __init__(...) __str__(...)

class ScribusException(exceptions.Exception)
Methods inherited from exceptions.Exception: __getitem__(...) __init__(...) __str__(...)

class WrongFrameTypeError(ScribusException)
Method resolution order: WrongFrameTypeError ScribusException exceptions.Exception
Methods inherited from exceptions.Exception: __getitem__(...) __init__(...) __str__(...)

### Functions

changeColor(...)
  `changeColor("name", c, m, y, k)
  Changes the color "name" to the specified CMYK value. The color value is defined via four components c = Cyan, m = Magenta, y = Yellow and k = Black. Color components should be in the range from 0 to 255.
  May raise NotFoundError if the named color wasn't found.
  May raise ValueError if an invalid color name is specified.`
closeDoc(...)
  `closeDoc()
  Closes the current document without prompting to save.
  May throw NoDocOpenError if there is no document to close`
createBezierLine(...)
  `createBezierLine(list, ["name"]) -> string
  Creates a new bezier curve and returns its name. The points for the bezier curve are stored in the list "list" in the following order:
  [x1, y1, kx1, ky1, x2, y2, kx2, ky2...xn. yn, kxn. kyn]
  In the points list, x and y mean the x and y coordinates of the point and kx and ky meaning the control point for the curve. The coordinates are given in the current measurement units of the document (see UNIT constants). "name" should be a unique identifier for the object because you need this name for further access to that object. If "name" is not given Scribus will create one for you.
  May raise NameExistsError if you explicitly pass a name that's already used.
  May raise ValueError if an insufficient number of points is passed or if the number of values passed don't group into points without leftovers.`
createEllipse(...)
  `createEllipse(x, y, width, height, ["name"]) -> string
  Creates a new ellipse on the current page and returns its name. The coordinates are given in the current measurement units of the document (see UNIT constants). "name" should be a unique identifier for the object because you need this name for further referencing of that object. If "name" is not given Scribus will create one for you.
  May raise NameExistsError if you explicitly pass a name that's already used.`
createImage(...)
  `createImage(x, y, width, height, ["name"]) -> string
  Creates a new picture frame on the current page and returns its name. The coordinates are given in the current measurement units of the document. "name" should be a unique identifier for the object because you need this name for further access to that object. If "name" is not given Scribus will create one for you.
  May raise NameExistsError if you explicitly pass a name that's already used.`
createLayer(...)
  `createLayer(layer)
  Creates a new layer with the name "name".
  May raise ValueError if the layer name isn't acceptable.`
createLine(...)
  `createLine(x1, y1, x2, y2, ["name"]) -> string
  Creates a new line from the point(x1, y1) to the point(x2, y2) and returns its name. The coordinates are given in the current measurement unit of the document (see UNIT constants). "name" should be a unique identifier for the object because you need this name for further access to that object. If "name" is not given Scribus will create one for you.
  May raise NameExistsError if you explicitly pass a name that's already used.`
createPathText(...)
  `createPathText(x, y, "textbox", "beziercurve", ["name"]) -> string
  Creates a new pathText by merging the two objects "textbox" and "beziercurve" and returns its name. The coordinates are given in the current measurement unit of the document (see UNIT constants). "name" should be a unique identifier for the object because you need this name for further access to that object. If "name" is not given Scribus will create one for you.
  May raise NameExistsError if you explicitly pass a name that's already used.
  May raise NotFoundError if one or both of the named base object don't exist.`
createPolyLine(...)
  `createPolyLine(list, ["name"]) -> string
  Creates a new polyline and returns its name. The points for the polyline are stored in the list "list" in the following order: [x1, y1, x2, y2...xn. yn]. The coordinates are given in the current measurement units of the document (see UNIT constants). "name" should be a unique identifier for the object because you need this name for further access to that object. If "name" is not given Scribus will create one for you.
  May raise NameExistsError if you explicitly pass a name that's already used.
  May raise ValueError if an insufficient number of points is passed or if the number of values passed don't group into points without leftovers.`
createPolygon(...)
  `createPolygon(list, ["name"]) -> string
  Creates a new polygon and returns its name. The points for the polygon are stored in the list "list" in the following order: [x1, y1, x2, y2...xn. yn]. At least three points are required. There is no need to repeat the first point to close the polygon. The polygon is automatically closed by connecting the first and the last point. The coordinates are given in the current measurement units of the document (see UNIT constants). "name" should be a unique identifier for the object because you need this name for further access to that object. If "name" is not given Scribus will create one for you.
  May raise NameExistsError if you explicitly pass a name that's already used.
  May raise ValueError if an insufficient number of points is passed or if
  the number of values passed don't group into points without leftovers.`
createRect(...)
  `createRect(x, y, width, height, ["name"]) -> string
  Creates a new rectangle on the current page and returns its name. The coordinates are given in the current measurement units of the document (see UNIT constants). "name" should be a unique identifier for the object because you need this name to reference that object in future. If "name" is not given Scribus will create one for you.
  May raise NameExistsError if you explicitly pass a name that's already used.`
createText(...)
  `createText(x, y, width, height, ["name"]) -> string
  Creates a new text frame on the actual page and returns its name. The coordinates are given in the actual measurement unit of the document (see UNIT constants). "name" should be a unique identifier for the object because you need this name for further referencing of that object. If "name" is not given Scribus will create one for you.
  May raise NameExistsError if you explicitly pass a name that's already used.`
currentPage(...)
  `currentPage() -> integer
  Returns the number of the current working page. Page numbers are counted from 1 upwards, no matter what the displayed first page number of your document is.`
defineColor(...)
  `defineColor("name", c, m, y, k)
  Defines a new color "name". The color Value is defined via four components:
  c = Cyan, m = Magenta, y = Yellow and k = Black. Color components should be in the range from 0 to 255.
  May raise ValueError if an invalid color name is specified.`
deleteColor(...)
  `deleteColor("name", "replace")
  Deletes the color "name". Every occurence of that color is replaced by the color "replace". If not specified, "replace" defaults to the color "None" - transparent.
  deleteColor works on the default document colors if there is no document open. In that case, "replace", if specified, has no effect.
  May raise NotFoundError if a named color wasn't found.
  May raise ValueError if an invalid color name is specified.`
deleteLayer(...)
  `deleteLayer("layer")
  Deletes the layer with the name "layer". Nothing happens if the layer doesn't exists or if it's the only layer in the document.
  May raise NotFoundError if the layer can't be found.
  May raise ValueError if the layer name isn't acceptable.`
deleteObject(...)
  `deleteObject(["name"])
  Deletes the item with the name "name". If "name" is not given the currently selected item is deleted.`
deletePage(...)
  `deletePage(nr)
  Deletes the given page. Does nothing if the document contains only one page. Page numbers are counted from 1 upwards, no matter what the displayed first page number is.
  May raise IndexError if the page number is out of range`
deleteText(...)
  `deleteText(["name"])
  Deletes any text in the text frame "name". If there is some text selected, only the selected text will be deleted. If "name" is not given the currently selected item is used.`
deselectAll(...)
  `deselectAll()
  Deselects all objects in the whole document.`
docChanged(...)
  `docChanged(bool)
  Enable/disable save icon in the Scribus icon bar and the Save menu item. It's useful to call this procedure when you're changing the document, because Scribus won't automatically notice when you change the document using a script.`
fileDialog(...)
  `fileDialog("caption", ["filter", "defaultname" ,haspreview, issave]) -> string with filename
  Shows a File Open dialog box with the caption "caption". Files are filtered with the filter string "filter". A default filename or file path can also supplied, leave this string empty when you don't want to use it. A value of True for haspreview enables a small preview widget in the FileSelect box. When the issave parameter is set to True the dialog acts like a "Save As" dialog otherwise it acts like a "File Open Dialog". The default for both of the opional parameters is False.
  The filter, if specified, takes the form 'comment (*.type *.type2 ...)'.
  For example 'Images (*.png *.xpm *.jpg)'.
  Refer to the Qt-Documentation for QFileDialog for details on filters.
  Example: fileDialog('Open input', 'CSV files (*.csv)')
  Example: fileDialog('Save report', defaultname='report.txt', issave=True)`
getActiveLayer(...)
  `getActiveLayer() -> string
  Returns the name of the current active layer.`
getAllObjects(...)
  `getAllObjects() -> list
  Returns a list containing the names of all objects on the current page.`
getAllStyles(...)
  `getAllStyles() -> list
  Return a list of the names of all paragraph styles in the current document.`
getAllText(...)
  `getAllText(["name"]) -> string
  Returns the text of the text frame "name" and of all text frames which are linked with this frame. If this textframe has some text selected, the selected text is returned. If "name" is not given the currently selected item is used.`
getColor(...)
  `getColor("name") -> tuple
  Returns a tuple (C, M, Y, K) containing the four color components of the color "name" from the current document. If no document is open, returns the value of the named color from the default document colors.
  May raise NotFoundError if the named color wasn't found.
  May raise ValueError if an invalid color name is specified.`
getColorAsRGB(...)
  `getColorAsRGB("name") -> tuple`

  Returns a tuple (R,G,B) containing the three color components of the color "name" from the current document, converted to the RGB colour space. If no document is open, returns the value of the named color from the default document colors.

  May raise NotFoundError if the named color wasn't found. May raise ValueError if an invalid color name is specified.

getColorNames(...)
  `getColorNames() -> list
  Returns a list containing the names of all defined colors in the document. If no document is open, returns a list of the default document colors.`
getColumnGap(...)
  `getColumnGap(["name"]) -> float
  Returns the column gap size of the text frame "name" expressed in points. If "name" is not given the currently selected item is used.`
getColumns(...)
  `getColumns(["name"]) -> integer
  Gets the number of columns of the text frame "name". If "name" is not given the currently selected item is used.`
getCornerRadius(...)
  `getCornerRadius(["name"]) -> integer
  Returns the corner radius of the object "name". The radius is expressed in points. If "name" is not given the currently selected item is used.`
getFillColor(...)
  `getFillColor(["name"]) -> string
  Returns the name of the fill color of the object "name". If "name" is not given the currently selected item is used.`
getFillShade(...)
  `getFillShade(["name"]) -> integer
  Returns the shading value of the fill color of the object "name". If "name" is not given the currently selected item is used.`
getFont(...)
  `getFont(["name"]) -> string
  Returns the font name for the text frame "name". If this text frame has some text selected the value assigned to the first character of the selection is returned. If "name" is not given the currently selected item is used.`
getFontNames(...)
  `getFontNames() -> list
  Returns a list with the names of all available fonts.`
getFontSize(...)
  `getFontSize(["name"]) -> float
  Returns the font size in points for the text frame "name". If this text frame has some text selected the value assigned to the first character of the selection is returned. If "name" is not given the currently selected item is used.`
getGuiLanguage(...)
  `getGuiLanguage() -> string
  Returns a string with the -lang value.`
getHGuides(...)
  `getHGuides() -> list
  Returns a list containing positions of the horizontal guides. Values are in the document's current units - see UNIT_<type> constants.`
getImageFile(...)
  `getImageName(["name"]) -> string
  Returns the filename for the image in the image frame. If "name" is not given the currently selected item is used.`
getImageScale(...)
  `getImageScale(["name"]) -> (x,y)
  Returns a (x, y) tuple containing the scaling values of the image frame "name". If "name" is not given the currently selected item is used.`
getLayers(...)
  `getLayers() -> list
  Returns a list with the names of all defined layers.`
getLineCap(...)
  `getLineEnd(["name"]) -> integer (see constants)
  Returns the line cap style of the object "name". If "name" is not given the currently selected item is used. The cap types are:
  CAP_FLAT, CAP_ROUND, CAP_SQUARE`
getLineColor(...)
  `getLineColor(["name"]) -> string
  Returns the name of the line color of the object "name". If "name" is not given the currently selected item is used.`
getLineJoin(...)
  `getLineJoin(["name"]) -> integer (see contants)
  Returns the line join style of the object "name". If "name" is not given the currently selected item is used. The join types are:
  JOIN_BEVEL, JOIN_MITTER, JOIN_ROUND`
getLineShade(...)
  `getLineShade(["name"]) -> integer
  Returns the shading value of the line color of the object "name". If "name" is not given the currently selected item is used.`
getLineSpacing(...)
  `getLineSpacing(["name"]) -> float
  Returns the line spacing ("leading") of the text frame "name" expressed in points. If "name" is not given the currently selected item is used.`
getLineStyle(...)
  `getLineStyle(["name"]) -> integer (see constants)
  Returns the line style of the object "name". If "name" is not given the currently selected item is used. Line style constants are:
  LINE_DASH, LINE_DASHDOT, LINE_DASHDOTDOT, LINE_DOT, LINE_SOLID`
getLineWidth(...)
  `getLineWidth(["name"]) -> integer
  Returns the line width of the object "name". If "name" is not given the currently selected Item is used.`
getPageItems(...)
  `getPageItems() -> list
  Returns a list of tuples with items on the current page. The tuple is:
  (name, objectType, order) E.g. [('Text1', 4, 0), ('Image1', 2, 1)]
  means that object named 'Text1' is a text frame (type 4) and is the first at
  the page...`
getPageMargins(...)
  `getPageMargins()
  Returns the page margins as a (left, right, top, bottom) tuple in the current units. See UNIT_<type> constants and getPageSize().`
getPageSize(...)
  `getPageSize() -> tuple
  Returns a tuple with page dimensions measured in the document's current units.
  See UNIT_<type> constants and getPageMargins()`
getPosition(...)
  `getPosition(["name"]) -> (x,y)
  Returns a (x, y) tuple with the position of the object "name". If "name" is not given the currently selected item is used. The position is expressed in the actual measurement unit of the document - see UNIT_<type> for reference.`
getRotation(...)
  `getRotation(["name"]) -> integer
  Returns the rotation of the object "name". The value is expressed in degrees, and clockwise is positive. If "name" is not given the currently selected item is used.`
getSelectedObject(...)
  `getSelectedObject([nr]) -> string
  Returns the name of the selected object. "nr" if given indicates the number of the selected object, e.g. 0 means the first selected object, 1 means the second selected Object and so on.`
getSize(...)
  `getSize(["name"]) -> (width,height)
  Returns a (width, height) tuple with the size of the object "name". If "name" is not given the currently selected item is used. The size is expressed in the current measurement unit of the document - see UNIT_<type> for reference.`
getText(...)
  `getText(["name"]) -> string
  Returns the text of the text frame "name". If this text frame has some text selected, the selected text is returned. All text in the frame, not just currently visible text, is returned. If "name" is not given the currently selected item is used.`
getTextColor(...)
  `getLineColor(["name"]) -> string
  Returns the name of the line color of the object "name".If "name" is not given the currently selected item is used.`
getTextLength(...)
  `getTextLength(["name"]) -> integer
  Returns the length of the text in the text frame "name". If "name" is not given the currently selected item is used.`
getTextShade(...)
  `getLineShade(["name"]) -> integer
  Returns the shading value of the line color of the object "name". If "name" is not given the currently selected item is used.`
getUnit(...)
  `getUnit() -> integer (Scribus unit constant)
  Returns the measurement units of the document. The returned value will be one of the UNIT_* constants:
  UNIT_INCHES, UNIT_MILLIMETERS, UNIT_PICAS, UNIT_POINTS.`
getVGuides(...)
  `getVGuides()
  See getHGuides.`
getXFontNames(...)
  `getXFontNames() -> list of tuples
  Returns a larger font info. It's a list of the tuples with:
  [ (Scribus name, Family, Real name, subset (1|0), embed PS (1|0), font file), (...), ... ]`
getval(...)
  `Scribus internal.`
gotoPage(...)
  `gotoPage(nr)
  Moves to the page "nr" (that is, makes the current page "nr"). Note that gotoPage doesn't (curently) change the page the user's view is displaying, it just sets the page that script commands will operates on.
  May raise IndexError if the page number is out of range.`
groupObjects(...)
  `groupObjects(list)
  Groups the objects named in "list" together. "list" must contain the names of the objects to be grouped. If "list" is not given the currently selected items are used.`
haveDoc(...)
  `haveDoc() -> bool
  Returns true if there is a document open.`
insertText(...)
  `insertText("text", pos, ["name"])
  Inserts the text "text" at the position "pos" into the text frame. Text must be UTF encoded (see setText() as reference) The first character has an index of 0. "name" If "name" is not given the currently selected Item is used.
  May throw IndexError for an insertion out of bounds.`
isLayerPrintable(...)
  `isLayerPrintable("layer") -> bool
  Returns whether the layer "layer" is printable or not, a value of True means that the layer "layer" can be printed, a value of False means that printing the layer "layer" is disabled.
  May raise NotFoundError if the layer can't be found.
  May raise ValueError if the layer name isn't acceptable.`
isLayerVisible(...)
  `isLayerPrintable("layer") -> bool
  Returns whether the Layer "layer" is visible or not, a value of True means that the layer "layer" is visible, a value of False means that the layer "layer" is invisible.
  May raise NotFoundError if the layer can't be found.
  May raise ValueError if the layer name isn't acceptable.`
isLocked(...)
  `isLocked(["name"]) -> bool
  Returns true if is the object "name" locked. If "name" is not given the currently selected item is used.`
isPDFBookmark(...)
  `isPDFBookmark(["name"]) -> bool`

  Returns true if the text frame "name" is a PDF bookmark. If "name" is not given the currently selected item is used.

  May raise WrongFrameTypeError if the target frame is not a text frame.

linkTextFrames(...)
  `linkTextFrames("fromname", "toname")
  Link two text frames. The frame named "fromname" is linked to the frame named "toname". The target frame must be an empty text frame and must not link to or be linked from any other frames already.
  May throw ScribusException if linking rules are violated.`
loadImage(...)
  `loadImage("filename" [, "name"])
  Loads the picture "picture" into the image frame "name". If "name" is not given the currently selected item is used.
  May raise WrongFrameTypeError if the target frame is not an image frame`
loadStylesFromFile(...)
  `loadStylesFromFile("filename")
  Loads paragraph styles from the Scribus document at "filename" into the current document.`
lockObject(...)
  `lockObject(["name"]) -> bool
  Locks the object "name" if it's unlocked or unlock it if it's locked. If "name" is not given the currently selected item is used. Returns true if locked.`
messageBox(...)
  `messageBox("caption", "message", icon=ICON_NONE, button1=BUTTON_OK|BUTTONOPT_DEFAULT, button2=BUTTON_NONE, button3=BUTTON_NONE) -> integer
  Displays a message box with the title "caption", the message "message", and an icon "icon" and up to 3 buttons. By default no icon is used and a single button, OK, is displayed. Only the caption and message arguments are required, though setting an icon and appropriate button(s) is strongly recommended. The message text may contain simple HTML-like markup.
  Returns the number of the button the user pressed. Button numbers start at 1.
  For the icon and the button parameters there are predefined constants available with the same names as in the Qt Documentation. These are the BUTTON_* and ICON_* constants defined in the module. There are also two extra constants that can be binary-ORed with button constants:
  BUTTONOPT_DEFAULT Pressing enter presses this button.
  BUTTONOPT_ESCAPE Pressing escape presses this button.
  Usage examples:
  result = messageBox('Script failed',
  'This script only works when you have a text frame selected.',
  ICON_ERROR)
  result = messageBox('Monkeys!', 'Something went ook! <i>Was it a monkey?</i>',
  ICON_WARNING, BUTTON_YES|BUTTONOPT_DEFAULT,
  BUTTON_NO, BUTTON_IGNORE|BUTTONOPT_ESCAPE)
  Defined button and icon constants:
  BUTTON_NONE, BUTTON_ABORT, BUTTON_CANCEL, BUTTON_IGNORE, BUTTON_NO,
  BUTTON_NOALL, BUTTON_OK, BUTTON_RETRY, BUTTON_YES, BUTTON_YESALL,
  ICON_NONE, ICON_INFORMATION, ICON_WARNING, ICON_CRITICAL.`
messagebarText(...)
  `messagebarText("string")
  Writes the "string" into the Scribus message bar (status line). The text
  must be UTF8 encoded or 'unicode' string(recommended).`

moveObject(...)
  `moveObject(dx, dy [, "name"])
  Moves the object "name" by dx and dy relative to its current position. The
  distances are expressed in the current measurement unit of the document (see
  UNIT constants). If "name" is not given the currently selected item is used.
  If the object "name" belongs to a group, the whole group is moved.`
moveObjectAbs(...)
  `moveObjectAbs(x, y [, "name"])
  Moves the object "name" to a new location. The coordinates are expressed in
  the current measurement unit of the document (see UNIT constants). If "name"
  is not given the currently selected item is used. If the object "name"
  belongs to a group, the whole group is moved.`
newDoc(...)
  `newDoc(size, margins, orientation, firstPageNumber,
  unit, facingPages, firstSideLeft) -> bool
  Creates a new document and returns true if successful. The parameters have the
  following meaning:
  size = A tuple (width, height) describing the size of the document. You can
  use predefined constants named PAPER_<paper_type> e.g. PAPER_A4 etc.
  margins = A tuple (left, right, top, bottom) describing the document
  margins
  orientation = the page orientation - constants PORTRAIT, LANDSCAPE
  firstPageNumber = is the number of the first page in the document used for
  pagenumbering. While you'll usually want 1, it's useful to have higher
  numbers if you're creating a document in several parts.
  unit: this value sets the measurement units used by the document. Use a
  predefined constant for this, one of: UNIT_INCHES, UNIT_MILLIMETERS,
  UNIT_PICAS, UNIT_POINTS.
  facingPages = FACINGPAGES, NOFACINGPAGES
  firstSideLeft = FIRSTPAGELEFT, FIRSTPAGERIGHT
  The values for width, height and the margins are expressed in the given unit
  for the document. PAPER_* constants are expressed in points. If your document
  is not in points, make sure to account for this.
  example: newDoc(PAPER_A4, (10, 10, 20, 20), LANDSCAPE, 1, UNIT_POINTS,
  FACINGPAGES, FIRSTPAGERIGHT)`
newDocDialog(...)
  `newDocDialog() -> bool
  Displays the "New Document" dialog box. Creates a new document if the user accepts the settings. Does not create a document if the user presses cancel. Returns true if a new document was created.`
newPage(...)
  `newPage(where [,"template"])
  Creates a new page. If "where" is -1 the new Page is appended to the document, otherwise the new page is inserted before "where". Page numbers are counted from 1 upwards, no matter what the displayed first page number of your document is. The optional parameter "template" specifies the name of the template page for the new page.
  May raise IndexError if the page number is out of range`
objectExists(...)
  `objectExists(["name"]) -> bool
  Test if an object with specified name really exists in the document. The optional parameter is the object name. When no object name is given, returns True if there is something selected.`
openDoc(...)
  `openDoc("name")
  Opens the document "name".
  May raise ScribusError if the document could not be opened.`
pageCount(...)
  `pageCount() -> integer
  Returns the number of pages in the document.`
pageDimension(...)
  `getPageSize() -> tuple
  Returns a tuple with page dimensions measured in the document's current units.
  See UNIT_<type> constants and getPageMargins()`
progressReset(...)
  `progressReset()
  Cleans up the Scribus progress bar previous settings. It is called before the new progress bar use. See progressSet.`
progressSet(...)
  `progressSet(nr)
  Set the progress bar position to "nr", a value relative to the previously set progressTotal. The progress bar uses the concept of steps; you give it the total number of steps and the number of steps completed so far and it will display the percentage of steps that have been completed. You can specify the total number of steps with progressTotal(). The current number of steps is set with progressSet(). The progress bar can be rewound to the beginning with progressReset(). [based on info taken from Trolltech's Qt docs]`
progressTotal(...)
  `progressTotal(max)
  Sets the progress bar's maximum steps value to the specified number. See progressSet.`
redrawAll(...)
  `redrawAll()
  Redraws all pages.`
renderFont(...)
  `rendeFont("name", "filename", "sample", size, format="PPM") -> bool`

  Creates an image preview of font "name" with given text "sample" and size. Image is saved into "filename". Returns true when success. The optional "format" argument specifies the image format to generate, and supports any format allowed by QPixmap.save(). Common formats are PPM, JPEG, PNG and XPM.

  May raise NotFoundError if the specified font can't be found. May raise ValueError if an empty sample or filename is passed.

replaceColor(...)
  `replaceColor("name", "replace")
  Every occurence of the color "name" is replaced by the color "replace".
  May raise NotFoundError if a named color wasn't found.
  May raise ValueError if an invalid color name is specified.`
retval(...)
  `Scribus internal.`
rotateObject(...)
  `rotateObject(rot [, "name"])
  Rotates the object "name" by "rot" degrees relatively. The object is rotated by the vertex that is currently selected as the rotation point - by default, the top left vertext at zero rotation. Positive values mean counter clockwise rotation when the default rotation point is used. If "name" is not given the currently selected item is used.`
rotateObjectAbs(...)
  `rotateObjectAbs(rot [, "name"])
  Sets the rotation of the object "name" to "rot". Positive values mean counter clockwise rotation. If "name" is not given the currently selected item is used.`
saveDoc(...)
  `saveDoc()
  Saves the current document with its current name, returns true if successful. If the document has not already been saved, this may bring up an interactive save file dialog.
  If the save fails, there is currently no way to tell.`
saveDocAs(...)
  `saveDocAs("name")
  Saves the current document under the new name "name" (which may be a full or relative path).
  May raise ScribusError if the save fails.`
savePageAsEPS(...)
  `savePageAsEPS("name")
  Saves the current page as an EPS to the file "name".
  May raise ScribusError if the save failed.`
scaleGroup(...)
  `scaleGroup(factor [,"name"])
  Scales the group the object "name" belongs to. Values greater than 1 enlarge the group, values smaller than 1 make the group smaller e.g a value of 0.5 scales the group to 50 % of its original size, a value of 1.5 scales the group to 150 % of its original size. The value for "factor" must be greater than 0. If "name" is not given the currently selected item is used.
  May raise ValueError if an invalid scale factor is passed.`
scaleImage(...)
  `scaleImage(x, y [, "name"])
  Sets the scaling factors of the picture in the image frame "name". If "name" is not given the currently selected item is used. A number of 1 means 100 %.
  May raise WrongFrameTypeError if the target frame is not an image frame`
selectObject(...)
  `selectObject("name")
  Selects the object with the given "name".`
selectText(...)
  `selectText(start, count, ["name"])
  Selects "count" characters of text in the text frame "name" starting from the character "start". Character counting starts at 0. If "count" is zero, any text selection will be cleared. If "name" is not given the currently selected item is used.
  May throw IndexError if the selection is outside the bounds of the text.`
selectionCount(...)
  `selectionCount() -> integer
  Returns the number of selected objects.`
sentToLayer(...)
  `sentToLayer("layer" [, "name"])
  Sends the object "name" to the layer "layer". The layer must exist. If "name" is not given the currently selected item is used.
  May raise NotFoundError if the layer can't be found.
  May raise ValueError if the layer name isn't acceptable.`
setActiveLayer(...)
  `setActiveLayer("name")
  Sets the active layer to the layer named "name".
  May raise NotFoundError if the layer can't be found.
  May raise ValueError if the layer name isn't acceptable.`
setColumnGap(...)
  `setColumnGap(size, ["name"])
  Sets the column gap of the text frame "name" to the value "size". If "name" is not given the currently selected item is used.
  May throw ValueError if the column gap is out of bounds (must be positive).`
setColumns(...)
  `setColumns(nr, ["name"])
  Sets the number of columns of the text frame "name" to the integer "nr". If "name" is not given the currently selected item is used.
  May throw ValueError if number of columns is not at least one.`
setCornerRadius(...)
  `setCornerRadius(radius, ["name"])
  Sets the corner radius of the object "name". The radius is expressed in points. If "name" is not given the currently selected item is used.
  May raise ValueError if the corner radius is negative.`
setCursor(...)
  `setCursor()
  [UNSUPPORTED!] This might break things, so steer clear for now.`
setDocType(...)
  `setDocType(facingPages, firstPageLeft)
  Sets the document type. To get facing pages set the first parameter to FACINGPAGES, to switch facingPages off use NOFACINGPAGES instead. If you want to be the first page a left side set the second parameter to FIRSTPAGELEFT, for a right page use FIRSTPAGERIGHT.`
setFillColor(...)
  `setFillColor("color", ["name"])
  Sets the fill color of the object "name" to the color "color". "color" is the name of one of the defined colors. If "name" is not given the currently selected item is used.`
setFillShade(...)
  `setFillShade(shade, ["name"])
  Sets the shading of the fill color of the object "name" to "shade". "shade" must be an integer value in the range from 0 (lightest) to 100 (full Color intensity). If "name" is not given the currently selected Item is used. May raise ValueError if the fill shade is out of bounds.`
setFont(...)
  `setFont("font", ["name"])
  Sets the font of the text frame "name" to "font". If there is some text selected only the selected text is changed. If "name" is not given the currently selected item is used.
  May throw ValueError if the font cannot be found.`
setFontSize(...)
  `setFontSize(size, ["name"])
  Sets the font size of the text frame "name" to "size". "size" is treated as a value in points. If there is some text selected only the selected text is changed. "size" must be in the range 1 to 512. If "name" is not given the currently selected item is used.
  May throw ValueError for a font size that's out of bounds.`
setGradientFill(...)
  `setGradientFill(type, "color1", shade1, "color2", shade2, ["name"])
  Sets the gradient fill of the object "name" to type. Color descriptions are the same as for setFillColor() and setFillShade(). See the constants for available types (FILL_<type>).`
setHGuides(...)
  `setHGuides(list)
  Sets horizontal guides. Input parameter must be a list of guide positions measured in the current document units - see UNIT_<type> constants.
  Example: setHGuides(getHGuides() + [200.0, 210.0] # add new guides without any lost
  setHGuides([90,250]) # replace current guides entirely`
setInfo(...)
  `saveDocAs("author", "info", "description") -> bool
  Sets the document information. "Author", "Info", "Description" are strings.`
setLayerPrintable(...)
  `setLayerPrintable("layer", printable)
  Sets the layer "layer" to be printable or not. If is the printable set to false the layer won't be printed.
  May raise NotFoundError if the layer can't be found.
  May raise ValueError if the layer name isn't acceptable.`
setLayerVisible(...)
  `setLayerVisible("layer", visible)
  Sets the layer "layer" to be visible or not. If is the visible set to false the layer is invisible.
  May raise NotFoundError if the layer can't be found.
  May raise ValueError if the layer name isn't acceptable.`
setLineCap(...)
  `setLineEnd(endtype, ["name"])
  Sets the line cap style of the object "name" to the style "cap".
  If "name" is not given the currently selected item is used. There are predefined constants for "cap" - CAP_<type>.`
setLineColor(...)
  `setLineColor("color", ["name"])
  Sets the line color of the object "name" to the color "color". If "name" is not given the currently selected item is used.`
setLineJoin(...)
  `setLineJoin(join, ["name"])
  Sets the line join style of the object "name" to the style "join". If "name" is not given the currently selected item is used. There are predefined constants for join - JOIN_<type>.`
setLineShade(...)
  `setLineShade(shade, ["name"])
  Sets the shading of the line color of the object "name" to "shade". "shade" must be an integer value in the range from 0 (lightest) to 100 (full color intensity). If "name" is not given the currently selected item is used.
  May raise ValueError if the line shade is out of bounds.`
setLineSpacing(...)
  `setLineSpacing(size, ["name"])
  Sets the line spacing ("leading") of the text frame "name" to "size". "size" is a value in points. If "name" is not given the currently selected item is used.
  May throw ValueError if the line spacing is out of bounds.`
setLineStyle(...)
  `setLineStyle(style, ["name"])
  Sets the line style of the object "name" to the style "style". If "name" is not given the currently selected item is used. There are predefined constants for "style" - LINE_<style>.`
setLineWidth(...)
  `setLineWidth(width, ["name"])
  Sets line width of the object "name" to "width". "width" must be in the range from 0.0 to 12.0 inclusive, and is measured in points. If "name" is not given the currently selected item is used.
  May raise ValueError if the line width is out of bounds.`
setMargins(...)
  `setMargins(lr, rr, tr, br)
  Sets the margins of the document, Left(lr), Right(rr), Top(tr) and Bottom(br) margins are given in the measurement units of the document - see UNIT_<type> constants.`
setMultiLine(...)
  `setMultiLine("namedStyle", ["name"])
  Sets the line style of the object "name" to the named style "namedStyle". If "name" is not given the currently selected item is used.
  May raise NotFoundError if the line style doesn't exist.`
setPDFBookmark(...)
  `setPDFBookmark("toggle", ["name"])`

  Sets wether (toggle = 1) the text frame "name" is a bookmark nor not. If "name" is not given the currently selected item is used.

  May raise WrongFrameTypeError if the target frame is not a text frame.

setRedraw(...)
  `setRedraw(bool)
  Disables page redraw when bool = False, otherwise redrawing is enabled. This change will persist even after the script exits, so make sure to call setRedraw(True) in a finally: clause at the top level of your script.`
setScaleImageToFrame(...)
  `setScaleImageToFrame(scaletoframe, proportional=None, name=<selection>)`

  Sets the scale to frame on the selected or specified image frame to `scaletoframe'. If `proportional' is specified, set fixed aspect ratio scaling to `proportional'. Both `scaletoframe' and `proportional' are boolean.

  May raise WrongFrameTypeError.

setStyle(...)
  `setStyle("style" [, "name"])
  Apply the named "style" to the object named "name". If is no object name given, it's applied on the selected object.`
setText(...)
  `setText("text", ["name"])
  Sets the text of the text frame "name" to the text of the string "text". Text must be UTF8 encoded - use e.g. unicode(text, 'iso-8859-2'). See the FAQ for more details. If "name" is not given the currently selected item is used.`
setTextAlignment(...)
  `setTextAlignment(align, ["name"])
  Sets the text alignment of the text frame "name" to the specified alignment. If "name" is not given the currently selected item is used. "align" should be one of the ALIGN_ constants defined in this module - see dir(scribus).
  May throw ValueError for an invalid alignment constant.`
setTextColor(...)
  `setTextColor("color", ["name"])
  Sets the text color of the text frame "name" to the color "color". If there is some text selected only the selected text is changed. If "name" is not given the currently selected item is used.`
setTextShade(...)
  `setTextShade(shade, ["name"])
  Sets the shading of the text color of the object "name" to "shade". If there is some text selected only the selected text is changed. "shade" must be an integer value in the range from 0 (lightest) to 100 (full color intensity). If "name" is not given the currently selected item is used.`
setTextStroke(...)
  `setTextStroke("color", ["name"])
  Set "color" of the text stroke. If "name" is not given the currently selected item is used.`
setUnit(...)
  `setUnit(type)
  Changes the measurement unit of the document. Possible values for "unit" are defined as constants UNIT_<type>.
  May raise ValueError if an invalid unit is passed.`
setVGuides(...)
  `setVGuides()
  See setHGuides.`
sizeObject(...)
  `sizeObject(width, height [, "name"])
  Resizes the object "name" to the given width and height. If "name" is not given the currently selected item is used.`
statusMessage(...)
  `messagebarText("string")
  Writes the "string" into the Scribus message bar (status line). The text must be UTF8 encoded or 'unicode' string(recommended).`
textFlowsAroundFrame(...)
  `textFlowsAroundFrame("name" [, state])
  Enables/disables "Text Flows Around Frame" feature for object "name". Called with parameters string name and optional boolean "state". If "state" is not passed, text flow is toggled.`
traceText(...)
  `traceText(["name"])
  Convert the text frame "name" to outlines. If "name" is not given the currently selected item is used.`
unGroupObject(...)
  `unGroupObjects("name")
  Destructs the group the object "name" belongs to.If "name" is not given the currently selected item is used.`
unlinkTextFrames(...)
  `unlinkTextFrames("name")
  Remove the specified (named) object from the text frame flow/linkage. If the frame was in the middle of a chain, the previous and next frames will be connected, eg 'a->b->c' becomes 'a->c' when you unlinkTextFrames(b)'
  May throw ScribusException if linking rules are violated.`
valueDialog(...)
  `valueDialog(caption, message [,defaultvalue]) -> string
  Shows the common 'Ask for string' dialog and returns its value as a string
  Parameters: window title, text in the window and optional 'default' value.
  Example: valueDialog('title', 'text in the window', 'optional')`

### Data

ALIGN_BLOCK = 4
ALIGN_CENTERED = 1
ALIGN_FORCED = 4
ALIGN_LEFT = 0
ALIGN_RIGHT = 2
Abort = 5
BUTTON_ABORT = 5
BUTTON_CANCEL = 2
BUTTON_IGNORE = 7
BUTTON_NO = 4
BUTTON_NONE = 0
BUTTON_OK = 1
BUTTON_RETRY = 6
BUTTON_YES = 3
BevelJoin = 64
CAP_FLAT = 0
CAP_ROUND = 32
CAP_SQUARE = 16
Cancel = 2
Centered = 1
Critical = 3
CrossDiagonalGradient = 4
DashDotDotLine = 5
DashDotLine = 4
DashLine = 2
DiagonalGradient = 3
DotLine = 3
FACINGPAGES = 1
FILL_CROSSDIAGONALG = 4
FILL_DIAGONALG = 3
FILL_HORIZONTALG = 1
FILL_NOG = 0
FILL_RADIALG = 5
FILL_VERTICALG = 2
FIRSTPAGELEFT = 1
FIRSTPAGERIGHT = 0
FacingPages = 1
FirstPageLeft = 1
FirstPageRight = 0
FlatCap = 0
Forced = 4
HorizontalGradient = 1
ICON_CRITICAL = 3
ICON_INFORMATION = 1
ICON_NONE = 0
ICON_WARNING = 2
Ignore = 7
Inches = 2
Information = 1
JOIN_BEVEL = 64
JOIN_MITTER = 0
JOIN_ROUND = 128
LANDSCAPE = 1
LINE_DASH = 2
LINE_DASHDOT = 4
LINE_DASHDOTDOT = 5
LINE_DOT = 3
LINE_SOLID = 1
Landscape = 1
LeftAlign = 0
Millimeters = 1
MiterJoin = 0
NOFACINGPAGES = 0
No = 4
NoButton = 0
NoFacingPages = 0
NoGradient = 0
NoIcon = 0
Ok = 1
PAPER_A0 = (2380.0, 3368.0)
PAPER_A1 = (1684.0, 2380.0)
PAPER_A2 = (1190.0, 1684.0)
PAPER_A3 = (842.0, 1190.0)
PAPER_A4 = (595.0, 842.0)
PAPER_A5 = (421.0, 595.0)
PAPER_A6 = (297.0, 421.0)
PAPER_A7 = (210.0, 297.0)
PAPER_A8 = (148.0, 210.0)
PAPER_A9 = (105.0, 148.0)
PAPER_B0 = (2836.0, 4008.0)
PAPER_B1 = (2004.0, 2836.0)
PAPER_B10 = (89.0, 125.0)
PAPER_B2 = (1418.0, 2004.0)
PAPER_B3 = (1002.0, 1418.0)
PAPER_B4 = (709.0, 1002.0)
PAPER_B5 = (501.0, 709.0)
PAPER_B6 = (355.0, 501.0)
PAPER_B7 = (250.0, 355.0)
PAPER_B8 = (178.0, 250.0)
PAPER_B9 = (125.0, 178.0)
PAPER_C5E = (462.0, 649.0)
PAPER_COMM10E = (298.0, 683.0)
PAPER_DLE = (312.0, 624.0)
PAPER_EXECUTIVE = (542.0, 720.0)
PAPER_FOLIO = (595.0, 935.0)
PAPER_LEDGER = (1224.0, 792.0)
PAPER_LEGAL = (612.0, 1008.0)
PAPER_LETTER = (612.0, 792.0)
PAPER_TABLOID = (792.0, 1224.0)
PORTRAIT = 0
Paper_A0 = (2380.0, 3368.0)
Paper_A1 = (1684.0, 2380.0)
Paper_A2 = (1190.0, 1684.0)
Paper_A3 = (842.0, 1190.0)
Paper_A4 = (595.0, 842.0)
Paper_A5 = (421.0, 595.0)
Paper_A6 = (297.0, 421.0)
Paper_A7 = (210.0, 297.0)
Paper_A8 = (148.0, 210.0)
Paper_A9 = (105.0, 148.0)
Paper_B0 = (2836.0, 4008.0)
Paper_B1 = (2004.0, 2836.0)
Paper_B10 = (89.0, 125.0)
Paper_B2 = (1418.0, 2004.0)
Paper_B3 = (1002.0, 1418.0)
Paper_B4 = (709.0, 1002.0)
Paper_B5 = (501.0, 709.0)
Paper_B6 = (355.0, 501.0)
Paper_B7 = (250.0, 355.0)
Paper_B8 = (178.0, 250.0)
Paper_B9 = (125.0, 178.0)
Paper_C5E = (462.0, 649.0)
Paper_Comm10E = (298.0, 683.0)
Paper_DLE = (312.0, 624.0)
Paper_Executive = (542.0, 720.0)
Paper_Folio = (595.0, 935.0)
Paper_Ledger = (1224.0, 792.0)
Paper_Legal = (612.0, 1008.0)
Paper_Letter = (612.0, 792.0)
Paper_Tabloid = (792.0, 1224.0)
Picas = 3
Points = 0
Portrait = 0
RadialGradient = 5
Retry = 6
RightAlign = 2
RoundCap = 32
RoundJoin = 128
SolidLine = 1
SquareCap = 16
UNIT_INCHES = 2
UNIT_MILLIMETERS = 1
UNIT_PICAS = 3
UNIT_POINTS = 0
VerticalGradient = 2
Warning = 2
Yes = 3
scribus_version = '1.2.2'
scribus_version_info = (1, 2, 2, '', 0)