[scribus] How can I add an automatic page number into a text frame in a Python script
gregp_ky at yahoo.com
Tue May 11 18:11:30 CEST 2010
On 05/11/2010 10:51 AM, Henry Hartley wrote:
> Andreas Huennebeck wrote:
>>> I'm writing a Python script which creates a text frame which
>>> should contain an automatic page number. In the Scribus GUI
>>> one can do this with Ctrl-Alt-Shift-P, but simply calling
>>> scribus.setText('#') in the Python script does not work
>>> (of course). Is there a way to create a Python string with
>>> special characters?
> Does currentPage(...) give you what you want?
> currentPage() -> integer
> Returns the number of the current working page. Page numbers
> are counted from 1 upwards, no matter what the displayed
> first page number of your document is.
I think what he wants is to be able to enter the page number character
Looking at an SLA file, I see that this is encoded as <var
name="pageno"/> (if it were some control-character so that you could
enter it from python, it would likely cause the XML to be not
well-formed), so you're not going to be able to do this from Scripter.
Generally what seems easiest is to make page numbering part of a Master
Page, which can be applied or not, depending on your layout, and could
be done after your document gets created by your script.
If you're obsessive about this, then use python to keep track of page
numbers, and just enter the number!
Also to consider: saving a page number text frame to the scrapbook (with
the page numbering character), then right-clicking on the item in the
Scrapbook, and Paste to Page, which will place it at the proper coordinates.
As with a large number of operations in Scribus there are many way to
accomplish some specific task.
More information about the scribus