[Scribus] python first try

Gregory Pittman gpittman
Mon Feb 12 18:41:44 CET 2007


Ruslan V. Sulakov wrote:
> I run a simple python script using puthon console..
>
> import encodings.idna
> aname = ""+getSelectedObject() 
> print aname
> t = encodings.idna.ToUnicode( 'text is here' ) 
> setText(aname, t) 
>
>
> But it returns such result:
> ----------
> Text2
> Traceback (most recent call last):
>   File "<console>", line 1, in ?
> NoValidObjectError: Object not found
> ----------
>
> How must I set  a text to a Text Box?
>   
Your note is a little cryptic, but if you look at a fragment of a script 
on the Wiki:

L = scribus.createText(15, 20, 200, 20)
scribus.setText("Dir: " + imagedir, L)
scribus.setTextAlignment(scribus.ALIGN_LEFT, L)
scribus.setFont("Luxi Sans Regular", L)
scribus.setFontSize(10, L)

you see that you need to create a Text frame (or have one first). I 
gather you already have a text frame 'Text2', but then you have your 
syntax wrong in setText -- the content should be first, then the frame name.

Greg



More information about the scribus mailing list