Making an Empty Space Around an Image Frame

From Scribus Public Wiki

Jump to: navigation, search
This article is part of the Scripts & Plugins series.
Scripter Plugins Other

One of the features that has yet to be added to Scribus is to be able to create empty space around an image frame. You can make space inside a text frame but not inside an image frame.

This script will automatically make a empty frame 10 points larger than a selected image frame.

 #!/usr/bin/env python
 # -*- coding: utf-8 -*-

 import sys
 try:
    import scribus

 except ImportError:
    print "This script only works from within Scribus"
    sys.exit(1)
    
 def makebox(x,y,w,h):
      a = scribus.createImage(x, y, w, h)
      scribus.textFlowsAroundFrame(a, 1)
      
 def main():
      if scribus.haveDoc():
          scribus.setRedraw(1)
          x,y = scribus.getPosition()
          w,h = scribus.getSize()
          x2 = x - border
          y2 = y - border
          w2 = w + border * 2
          h2 = h + border * 2
          makebox(x2,y2,w2,h2)
          scribus.redrawAll()
      else:
          result = scribus.messageBox('Error','You need a Document open, and a frame selected.')
          
 # Change the 'border' value to change the size of space around your frame
 border = 10
 main()

Since the default distances are in points, border = 10 means 10 points. Changing this line of the program will change the size of the border. Note that, as written, this program makes an even border around the original frame.

As far as I know, this should also work if the original selected frame was a text frame. Why would you want to do that? Consider the possibility of creating a text frame with a visible border, with some internal space separating the border from the text, yet you want to have an external space around the border of the frame; this program will do that for you.

Personal tools