Scribus Forums

Scribus => Beginner Talk => Topic started by: LeXa on October 19, 2025, 04:27:53 AM

Title: Text distances in Style editor
Post by: LeXa on October 19, 2025, 04:27:53 AM
Hello,
Discovering Scribus, I'm working on a photography calendar.

I'm using the calendar wizard script to generate pages, so each 'day box' is a text frame. Associated with a style. Very powerful to change style on the whole document.
I'm trying to apply a margin on the number of the day in the top left but with a margin as the example below.

https://pasteboard.co/kgQFqAYvwYyH.png (https://pasteboard.co/kgQFqAYvwYyH.png)

But I can't find this option, 'Text distances', in the style editor. I don't want to have to replicate that on each  (many) Text frame...

Someone know how to proceed or a workaround ?

Cheers,

Title: Re: Text distances in Style editor
Post by: a.l.e on October 19, 2025, 09:04:30 AM
Yes, we need frame styles!

As a workaround you can run this small script:

old_unit = scribus.getUnit()
scribus.setUnit(scribus.UNIT_MM)

TEXT_DISTANCE_LTRB = [0, 2, 1, 0] # mm

for page in range(1, scribus.pageCount() + 1):
  scribus.gotoPage(page)
  for item in scribus.getPageItems():
    if item[1] == 4 and scribus.getAllText(item[0]).isdigit():
      scribus.setTextDistances(*TEXT_DISTANCE_LTRB, item[0])

scribus.setUnit(old_unit)

Open your document, trigger "Script > Show console" and paste the script above in the upper part of the Script console.

The script will apply the distances defined in TEXT_DISTANCE_LTRB (left, top, right, bottom...) to each text frame in the document that only contains digits (in your case the frames with the dates)

There is no way to undo the changes, so if you're not happy with the result, you can run again the same script with different values or close the document without saving it.

P.S.: just tested: copy pasting from the snippet above seems to introduce unwanted characters. It might be safer to copy the script from https://github.com/aoloe/scribus-script-collection/blob/master/items-format/set-text-distance-in-calendar.py
Title: Re: Text distances in Style editor
Post by: utnik on October 19, 2025, 09:09:34 AM
hi lexa

you're right. those options are missing in the 'style manager'.
but (as so often) with a hack you can do it anyway:
hope that helps...

utnik

edit: while i was typing, ale gave a more advanced solution – you need to chose...