Book Spine Calculator: Difference between revisions

From Scribus Wiki
Jump to navigation Jump to search
m (Book Spine Calculator)
 
m (Rearranged the messages so they fit on the wiki)
Line 1: Line 1:
<pre>
<pre><nowiki>


#/usr/bin/env python
#/usr/bin/env python
Line 8: Line 8:


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 28: Line 32:
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>

Revision as of 05:57, 1 October 2010


#/usr/bin/env python

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)

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)