[scribus] Insert image as header into Scribus page

Roger hovergo at net-tech.com.au
Fri Dec 26 08:35:36 CET 2008


    I have the same images for header and sub headers saved as .tiff and .jpg
      From <help><scripter API><Setting Object Properties>
     loadImage(...)
     loadImage("filename" [, "name"])
     I have /setpage.py starting with Craig's address .py script as an example to
     learn from:
     selectfile = scribus.fileDialog("Select Your Image File/s", "*.*")
     file = open(selectfile, 'r')
     # newDocument(size, margins(lrtb), orientation, firstPageNumber, unit,
     pagesType, firstPageOrder, numPages) -> bool
     # newDocument(PAPER_A4, (10, 10, 20, 20), LANDSCAPE, 7, UNIT_POINTS, 
PAGE_4, 0, 1)
     if
 
scribus.newDocument(scribus.PAPER_A4,(15,12,15,15),scribus.LANDSCAPE,1,scribus.UNIT_POINTS,scribus.PAGE_1,0,1):
     	scribus.gotoPage(1)
     	scribus.loadImage(file,["header"])
     # where "header" is the name of the image box at the top of the page.

- Ignored:

     I get error message:
     Traceback (most recent call last):
        File "<string>", line 8, in <module>
        File "/home/roger/Scribus/scripts/setpage.py", line 59, in <module>
          scribus.loadImage(file,["header"])
     TypeError: coercing to Unicode: need string or buffer, file found

     --What am I doing wrong and how to fix please
     TIA
     Roger



- Done.




Subject:
Insert images with .py
From:
Roger <hovergo at net-tech.com.au>
Date:
Fri, 26 Dec 2008 17:54:00 +1100
To:
scribus-request at lists.scribus.net

Attempting to create a .py script to set up new newsletter page/s each issue.
I have the same images for header and sub headers saved as .tiff and .jpg


 From <help><scripter API><Setting Object Properties>

loadImage(...)
loadImage("filename" [, "name"])

I have /setpage.py starting with Craig's address .py script as an example to 
learn from:

selectfile = scribus.fileDialog("Select Your Image File/s", "*.*")
file = open(selectfile, 'r')

# newDocument(size, margins(lrtb), orientation, firstPageNumber, unit, 
pagesType, firstPageOrder, numPages) -> bool
# newDocument(PAPER_A4, (10, 10, 20, 20), LANDSCAPE, 7, UNIT_POINTS, PAGE_4, 0, 1)

if 
scribus.newDocument(scribus.PAPER_A4,(15,12,15,15),scribus.LANDSCAPE,1,scribus.UNIT_POINTS,scribus.PAGE_1,0,1):

     scribus.gotoPage(1)
     scribus.loadImage(file,["header"])
# where "header" is the name of the image box at the top of the page.

I get error message:
Traceback (most recent call last):
   File "<string>", line 8, in <module>
   File "/home/roger/Scribus/scripts/setpage.py", line 59, in <module>
     scribus.loadImage(file,["header"])
TypeError: coercing to Unicode: need string or buffer, file found

--What am I doing wrong and how to fix please
TIA
Roger





More information about the scribus mailing list