Scribus Forums

Scribus => Scripts and Plugins => Topic started by: Derek on May 25, 2018, 10:13:48 pm

Title: getPageType Strange Error
Post by: Derek on May 25, 2018, 10:13:48 pm
I'm faffing about with what should be a simple script. I'm creating a page, getting the margins, then trying to get the page type (0 = Left, 1 = Middle, 2 = Right) to create a text frame the correct position and size.

The code I'm using to try to get the page type is:
Code: [Select]
intPageType = scribus.getPageType()but that is generating an error:
Quote
Traceback (most recent call last):
  File "<string>", line 8, in <module>
  File "/home/derek/Data_OF/Scribus/Scripts/Hello World.py", line 47, in <module>
    intPageType = scribus.getPageType()
TypeError: function takes exactly 1 argument (0 given)

Replacing the line with:
Code: [Select]
intPageType = 1clears the error and the rest of the script (so far) works fine.

Either I'm doing something really silly, or getPageType doesn't work as documented. I haven't been able to find an example of it being used anywhere so far.

Suggestions?

Added May 26:I'm using Ubuntu 1804LTS, happens in Scribus 1.4.7 and yesterday's Scribus-Trunk build.
Title: Re: getPageType Strange Error
Post by: Nermander on May 26, 2018, 01:27:48 pm
The error message says the function needs an argument, and the paranthesis is empty.

I think you need to use

Code: [Select]
scribus.getPageType(<page identity>)
I have no idea what <page identity> shall be, but of course you will have to let the function know for which page you are requesting the Page Type.

Title: Re: getPageType Strange Error
Post by: a.l.e on May 26, 2018, 02:35:46 pm
... i guess that the page identity is the page number... starting from 0 or 1...