OK, I figured it out. The setTextColor has to be called AFTER the text has been inserted into the text box.
So this original code of mine did not work: t2 = createText(100,200,100,100) setTextColor( "mycolor", t2 ) insertText( "text color set", -1, t2 ) But this did work: t2 = createText(100,200,100,100) insertText( "text color set", -1, t2 ) setTextColor( "mycolor", t2 ) __ Eamonn > -----Original Message----- > From: O'Brien-Strain, Eamonn > Sent: Friday, June 26, 2009 12:18 > To: 'scribus at lists.scribus.info' > Subject: Setting text colour in text frame does not seem to > work using Python > > I cannot seem to get the setTextColor Python call to work. > > Below is an example script that reproduces the problem. It > creates three text boxes. > (1) The first one has no properties set and the text appears > as black as expected. > (2) The second text box has its textColor property set, but > this does not seem to have any effect and the text still > appears as black. > (3) The third text box has the fillColor property set, and as > expected the background appears coloured, which means the > colour is defined properly. > > Is there some error in how I am making these Python calls? > Or is there a bug in Scribus? > > I have tried this on version 1.3.5 on Linux that I build from > SVN several months ago. I also tried it on a Windows version > of 1.3.5svn that I downloaded a few months ago. > > Thanks, > __ > Eamonn > > ====================================================================== > from scribus import * > > t1 = createText(100,100,100,100) > insertText( "no color set", -1, t1 ) > > defineColor( "mycolor", 0, 120, 255, 10 ) > > t2 = createText(100,200,100,100) > setTextColor( "mycolor", t2 ) > insertText( "text color set", -1, t2 ) > > t3 = createText(100,300,100,100) > setFillColor( "mycolor", t3 ) > insertText( "fill color set", -1, t3 ) > ============================================================== > ========
