[Scribus] Python scripting: request for a printed introduction/feature

Christoph Schäfer christoph-schaefer
Wed Jun 8 04:18:28 CEST 2005

Hi all,

this is a post covering two issues for which I apologise, but they are 
closely related.

1. I want to use a part of the summer holidays to learn Python, because 
from what I read on the Wiki, the scripting features of scribus are 
*very* interesting. Unfortunately, most German introductions to Python 
are out of print at the moment. Are there any German members who can 
recommend a good introduction to Python still available (No web 
ressources, please. Old fashioned as I am, I need a book!)

2. I have found a nice OOo macro on oomacros.org, and I think a similar 
functionality would be *extremely* useful for scribus. The macro 
sets the page margins/print space exactly the way Gutenberg did, which 
is (for good reasons) still standard in modern page layout. Since 
scribus doesn't (yet) support facing pages, I always used OOo and a 
calculator to set proper margins in scribus. The author of the macro is 
Christian Kotz, and it is released under the LPGL, so I'm sure I'm not 
violating any copyrights by disclosing it in this forum:

REM  *****  BASIC  *****
REM  ***** (C)opyright by Christian Kotz 2004
REM  ***** use at your own risk
REM  ***** released under the LGPL

Sub Seitenspiegel
   Dim oStyleFamilies, oFamilies, oPageStyles, oStyle, oViewCursor, 
   Dim oDoc
   Dim ratio as Double
   oDoc = ThisComponent
   oViewCursor = oDoc.CurrentController.getViewCursor()
   oPageStyleName = oViewCursor.PageStyleName
   oPageStyles = oDoc.StyleFamilies.getByName("PageStyles")
   oStyle  = oPageStyles.getByName(oPageStyleName)
   ratio = oStyle.Height / oStyle.Width REM Sqr(2.0)
   oStyle.TopMargin = oStyle.LeftMargin * ratio
   oStyle.RightMargin = oStyle.LeftMargin * 2
   oStyle.BottomMargin = oStyle.RightMargin * ratio
   oStyle.PageStyleLayout = 3 REM MIRRORED
End Sub

I'd like to do the same thing in python, but unfortunately I still have 
to learn some things in this area. Maybe some of the Python-savvy folks 
here are faster in translating OOo BASIC to Python.

BTW, (this would be item # 3), having an option "book style - 
recommended for multi-page documents" at document setup would be a 
wonderful feature. In case there isn't a similar request already, I'll 
file a bug report.


More information about the scribus mailing list