2 #-----------------------------------------------------------
3 # Python script which creates a function "pagebbox(width, height)"
4 # that generates a bounding box of the specified width and height.
6 # Execute this script using menu option "File/Execute Script",
7 # if Python has been compiled in.
9 # Add key 'B' for popuppromt asking for page size. Add button to
10 # "Edit" menu for same. Add Ctrl-B and Ctrl-Shift-B for standard
11 # 8 1/2 x 11 and 11 x 17 page bounding boxes.
12 #-----------------------------------------------------------
14 def newbox(lx
, ly
, ux
, uy
):
15 h1
=newelement("Polygon")
16 plist
= [(lx
, ly
), (ux
, ly
), (ux
, uy
), (lx
, uy
)]
22 h1
= newbox(0, 0, w
, h
)
23 d
= {"style": 512, "color": (255, 165, 0)}
42 # note to self: should look at coord style, set default for A4 size
43 # if style is CM, not INCHES.
46 oscale
= p1
['output scale']
49 h1
= pagebbox(w
* oscale
* inchsc
, h
* oscale
* inchsc
)
53 popupprompt('Enter width x height:', 'intbbox')
61 bind('B', 'promptbbox')
62 bind('Control_b', 'stdbbox')
63 bind('Control_Shift_B', 'bigbbox')
65 newbutton('Edit', 'New BBox (B)', 'promptbbox')
66 # newtool('BBox', 'promptbbox', '', 'bounding box');
68 #-----------------------------------------------------------