[scribus-dev] Scripter: linked frames

Jean Ghali jghali at libertysurf.fr
Tue Mar 2 19:09:32 UTC 2021


Le 02/03/2021 à 19:41, Gregory Pittman a écrit :
> Has anyone had any luck using getFirstLinkedFrame() and getNextLinkedFrame()?
> 
> I have been trying to write a script that would march down a set of linked frames, so I could analyze the content. getFirstLinkedFrame() seems to work as expected, but not getNextLinkedFrame(). The script spins and spins and spins and won't quit.
> The documentation says that if you do this:
> 
> textbox = scribus.getNextLinkedFrame()
> 
> it returns None if there are no more, but what "value" is assigned to textbox in that case? I'm trying to stop execution of frame content analysis when it reaches that point.
> I even tried
> 
> while (textbox):
> 
> thinking that would evaluate to 0 if there were no more, but that doesn't work. Trying to put str(textbox) into a messageBox() doesn't work.
> 
> Greg
> 

Here an example which loops across frames of a text chain and print the name of each 
linked frame:

textbox = scribus.getNextLinkedFrame("Text1")
while textbox is not None:
	print(textbox)
	textbox = scribus.getNextLinkedFrame(textbox)

Jean





More information about the scribus-dev mailing list