Book Spine Calculator: Difference between revisions

From Scribus Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
 
Line 1: Line 1:
{{Scripting Index}}
A soft book cover would be something like this. The calculator below will determine the spine width given the number of pages and paper weight in gsm.
A soft book cover would be something like this. The calculator below will determine the spine width given the number of pages and paper weight in gsm.



Latest revision as of 00:59, 15 January 2011

This article is part of the Scripts series.

A soft book cover would be something like this. The calculator below will determine the spine width given the number of pages and paper weight in gsm.


Book Soft Cover.png

[Spine_Book_Template.sla.gz] if you wish to play with the original

The code below could do with some typical paper weights, however best talk to the printer about this.


#/usr/bin/env python
# -*- coding: utf-8 -*-

import scribus
import math  


from scribus import UNIT_POINTS,BUTTON_OK,ICON_WARNING
startMsg1 = "The conventional design suggests that spine width is calculated as follows: \n\n"
startMsg2 = "10 divided by 176, multiplied by the number of pages of text within the book, divided by 90, "
startMsg3 = "multiplied by the weight of the paper in gsm, add 1mm for the crease in the cover and this will give you a soft cover book thickness in millimetres.\n\n"
startMsg4 = "Add 3mm to this figure and you have the spine thickness of a hard covered book"
startMsg = startMsg1 + startMsg2 + startMsg3 + startMsg4


start = scribus.messageBox('Book Spine Width Calculator', startMsg, ICON_WARNING, BUTTON_OK)


P = scribus.valueDialog('Spine Calculator','Enter Number of pages')
P = float(P)
G = scribus.valueDialog('Spine Calculator','Enter Paper Weight (gsm)')
G = float(G)

# Need some sanity checks here, max and min values P and G

A = float(10)
B = float(176)

bsw = (A/B) * (P/90) * G + 1 + 3
bsw = float("%2.2f" % (bsw))
bsws = bsw - 3
P = int(P)
G = int(G)

widthMsg1 = "The spine thickness for a soft cover book of " + str(P) + " pages of " + str(G) + " gsm paper is " + str(bsws) + " mm.\n\n"
widthMsg2 = "The spine thickness for a hard cover book of " + str(P) + " pages of " + str(G) + " gsm paper is " + str(bsw) + " mm."
widthMsg = widthMsg1 + widthMsg2


end = scribus.messageBox('Book Spine Width', widthMsg, ICON_WARNING, BUTTON_OK)