[scribus] Problem with getProperty

Gregory Pittman gpittman at iglou.com
Fri Jun 5 14:25:29 UTC 2020


On 6/5/20 9:08 AM, Gregory Pittman wrote:
> On 6/5/20 6:46 AM, fernast at neuf.fr wrote:
>> <span style="font-family:arial,helvetica,sans-serif">Hello<br>
>> <br>
>> I am trying to get with a python script the following property objects (launch in the script console):</span><br>
>> <br>
>> import scribus<br>
>> scribus.getProperty("Image1", "imageXOffset")<br>
>> scribus.getProperty("Image2", "imageYOffset")<br>
>> <br>
>> scribus.getProperty("Image", "imageXScale")<br>
>> <br>
>> By comparing with the values in the property tab I get the right value for imageXScale but not for imageXOffset and imageXOffset<br>
>> <br>
>> Anybody has any suggestions on what am I doing wrong??
> 
> Hi,
> 
> It helps if you tell us what version of Scribus you're using.
> Secondly, please submit emails in plain text, not HTML.
> 
>>From what I can tell, the getObjectProperty() command has been deprecated, even in later 1.4.x versions.
> In 1.5.x, there is now getImageScale(), which returns a tuple of the x,y values.
> Similarly, there is now getImageOffset() which returns a tuple of the x,y values for that.
> 
> This is yet another reason to advance to 1.5.x Scribus.

Using this little script:

#!/usr/bin/env python
"""
imagescale_offset.py
"""
import scribus


if (scribus.haveDoc()):
    XScale, YScale = scribus.getImageScale()
    Xoff, Yoff = scribus.getImageOffset()
    scale = str(XScale) + ", " + str(YScale)
    offset = str(Xoff) + ", " + str(Yoff)
    scribus.messageBox("Scale and Offsets",scale + "\n" + offset, icon=scribus.ICON_NONE, button1 = scribus.BUTTON_OK)

else:
    scribus.messageBox('OOPS!','You need to have a document open',scribus.ICON_NONE,button1=scribus.BUTTON_OK)
    sys.exit(1)

I get no difference in the values in Properties and from the script. Offsets are in points and scaling in decimals (77% = 0.77)

Greg




More information about the scribus mailing list