Scribus Forums

Scribus => Scripts and Plugins => Topic started by: Alcantara on February 08, 2026, 12:39:16 PM

Title: How to use 'createCustomLineStyle'?
Post by: Alcantara on February 08, 2026, 12:39:16 PM
Hello.

The Scribus help section provides the following definition:

QuotecreateCustomLineStyle(...)

  createCustomLineStyle(styleName, style)

Creates the custom line style 'styleName'.

This function takes a list of dictionaries as a parameter for "style".
Each dictionary represents one subline within the style.
Dictionary can have those keys: [...]

1. What does "list of dictionaries" mean?

Is this the correct usage?

scribus.defineColorRGB("red_r", 254, 10, 10)
line_style = [
    {"Color": "red_r"},
    {"Dash": 1},
    {"LineEnd": 1},
    {"LineJoin": 0},
    {"Shade": 100},
    {"Width": 20.0}
]
scribus.createCustomLineStyle("aCustomStyle", line_style)

Or this?

scribus.defineColorRGB("red_r", 254, 10, 10)
line_style = [
  {"Color": "red_r",
  "Dash": 1,
  "LineEnd": 1,
  "LineJoin": 0,
  "Shade": 100,
  "Width": 20.0
  }
]
scribus.createCustomLineStyle("aCustomStyle", line_style)

2. How do you use the style created this way?

The scribus.setLineStyle() function accepts a number to indicate the style to assign to a line, not the string passed to createCustomLineStyle.

A short working example would make me happy. Thank you.
Title: Re: How to use 'createCustomLineStyle'?
Post by: a.l.e on February 08, 2026, 06:29:23 PM
For creating the style, I would say it's the second snippet.

Concerning applying the style, the function you mention seems to be about applying the pattern, not a named style.

I guess that <kbd>setCustomLineStyle()</kdb> is what you are looking for... That would also match the API function you're using for creating the style : - )