[scribus] scribus Digest, Vol 117, Issue 7

Gregory Pittman gpittman at iglou.com
Thu Dec 14 23:29:00 UTC 2017


On 12/14/2017 05:20 PM, Raquel García wrote:
> Thank you for your answer Greg. As I choose language while joining the
> list, somehow I assumed it was a "spanish scribus forum". :) My fault. I
> still manage with english, though it got quite mixed since I learned German.
> 
> I have seen something about editing the Image shape... But that is
> something I should do with every image. And using a larger image frame too.
> I thought there should be a general way to do this, because image margin is
> something that you would like to keep equal in all the document.
> 
> But if there is no other way, I will give this a try. For now I do not
> manage very large documents, so maybe I can manage with this.
> 

Hi Raquel,

One of the sayings we have had about Scribus is that there are many ways
to do things.

Here is what I might call Plan B: accomplishing this same thing with a
script. What it actually does is create a frame superimposed on any
frame you have selected (one of your image frames, for example). You run
it by selecting a frame, then running the script. It will ask for the
width of the border you wish to create, with a default value of 10
points. Change or not, click Ok to create the frame. When it is created
it is also set for Text Flows around Frame. If you wanted, you could
push this frame below your image, then change its background color to
make something that actually looks like a frame. Either way, there will
be empty space around your image.

Here is the text of the script (notice that I originally wrote this in
2005!). Attachments don't work on the mail list, so I will send the file
to you separately.

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# border_around_frame.py
#####################################################################
# This is a simple script to create an empty frame superimposed     #
# on a selected frame, creating a border. Change border value to    #
# suit.                                                             #
# Script will fail if you do not have a frame selected.             #
#                                                                   #
# © 2005.09.21  Gregory Pittman                                     #
# 2017.12.14 - added ability to set width of border                 #
# May be used and modified freely                                   #
#####################################################################
"""
Usage:
You must have a frame selected.
Run the script, and it asks for the width of the border,
in points, default is 10 -- decimals can be entered. A frame of
the appropriate dimensions and in the correct position is placed
superimposed on the selected frame, and
Text Flows around Frame is selected.
"""
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.createRect(x, y, w, h)
      scribus.textFlowMode(a, 1)
      scribus.setLineColor("None", a)

def main():
      if scribus.haveDoc():
	  pageunits = scribus.getUnit()
	  scribus.setUnit(0)
          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.setUnit(pageunits)
          scribus.redrawAll()
      else:
          result = scribus.messageBox('Error','You need a Document open,
and a frame selected.') # this is the tail-end of the line above

border = scribus.valueDialog("Border Size", "Enter size of border
(points)", "10")  # this is the tail-end of the line above
border = float(border)
main()


Greg




More information about the scribus mailing list