[scribus] Setting character style in a Python Script

Gregory Pittman gpittman at iglou.com
Fri Mar 18 00:25:16 UTC 2016


On 03/17/2016 07:15 PM, Julius Cordes wrote:
> Hi.
> 
> It seems that there's no possibility of applying character styles to a
> text selection using the Scripter. I need a function analog to
> `setStyle` that applies a character style to a text selection (similar
> to `setFont`).
> 
> A script snippet illustrating how I think how it should work:
> ~~~~~
> import scribus
> scribus.createText(40, 40, 90, 50, 'textrahmen')
> scribus.setText('Dies ist ein Test-Text.', 'textrahmen')
> scribus.selectObject('textrahmen')
> scribus.selectText(14, 4, 'textrahmen')
> scribus.setCharStyle('testcharstyle')
> ~~~~~
> 
> Is it possible to add a function `setCharStyle` to the next stable
> release of Scribus?


I don't know the answer to that question (we keep talking about
improving Scripter).
What you might consider in Python is to create a function with a
collection of text properties that you call within your script and apply
to some selected text. This is more or less what a character style is doing.

Greg



More information about the scribus mailing list