Book Spine Calculator: Difference between revisions

From Scribus Wiki
Jump to navigation Jump to search
m (Book Spine Calculator)
 
No edit summary
 
(6 intermediate revisions by one other user not shown)
Line 1: Line 1:
<pre>
{{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.
 
 
[[Image:Book_Soft_Cover.png|600px]]
 
[[http://wiki.scribus.net/index.php/File:Spine_Book_Template.sla.gz 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.
 
<pre><nowiki>


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


import scribus
import scribus
Line 8: Line 19:


from scribus import UNIT_POINTS,BUTTON_OK,ICON_WARNING
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


startMsg = "The conventional design suggests that spine width is calculated as follows \n\n10 divided by 176, multiplied by the number of pages of text within the book, divided by 90, 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 Add 3mm to this figure and you have the spine thickness of a hard covered book"


start = scribus.messageBox('Book Spine Width Calculator', startMsg, ICON_WARNING, BUTTON_OK)
start = scribus.messageBox('Book Spine Width Calculator', startMsg, ICON_WARNING, BUTTON_OK)
Line 18: Line 33:
G = scribus.valueDialog('Spine Calculator','Enter Paper Weight (gsm)')
G = scribus.valueDialog('Spine Calculator','Enter Paper Weight (gsm)')
G = float(G)
G = float(G)
# Need some sanity checks here, max and min values P and G


A = float(10)
A = float(10)
Line 28: Line 45:
G = int(G)
G = int(G)


widthMsg = "The spine thickness for a soft cover book of " + str(P) + " pages of " + str(G) + " gsm paper is " + str(bsws) + " mm.\n\nThe spine thickness for a hard cover book of " + str(P) + " pages of " + str(G) + " gsm paper is " + str(bsw) + " mm."
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)
end = scribus.messageBox('Book Spine Width', widthMsg, ICON_WARNING, BUTTON_OK)
</pre>
</nowiki></pre>

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)