[scribus] while loop in python script crashes scribus

a.l.e ale.comp_06 at xox.ch
Fri Jan 30 13:13:32 CET 2009


ciao chantal
> Here is my script (change the TexFile value if you want to execute it), the 
> text is longer than the page but you can ignore that I already solved it in 
> the long version of the script:
>   
...
> 		#maak textbox
> 		TextBox = scribus.createText(60, VerticalPosition, Width, Height)
> 		VerticalPosition=VerticalPosition+VerticalMarge+Height
> 		#vul de textbox
> 		scribus.setText(Add, TextBox)
> 		#check of alles wel past
> 		OverflowChar = scribus.textOverflows(TextBox)
> 		while OverflowChar > 0:
> 			Height=Height+100
> 			deleteObject(TextBox)
> 			TextBox = scribus.createText(60, VerticalPosition, Width, Height)
> 			scribus.setText(Add, TextBox)
> 			OverflowChar = scribus.textOverflows(TextBox)
>   

i wonder if it has to do with the fact that you delete and create the 
text frame on each iteration...

have you tried to use sizeObject() ?


and about the the newscripter engine: i guess that python will remain 
python: so, if you want to port the script to another version you will 
mostly just have to modify the calls to the scribus API, but you will be 
able to keep the script's structure.


i really have to play a bit with the scripter! ... if i only could find 
a task :-)


happy hacking
a.l.e




More information about the scribus mailing list