1 # Sample extension: zoom a window to maximum height
11 ('_Zoom Height', '<<zoom-height>>'),
15 def __init__(self
, editwin
):
16 self
.editwin
= editwin
18 def zoom_height_event(self
, event
):
19 top
= self
.editwin
.top
23 geom
= top
.wm_geometry()
24 m
= re
.match(r
"(\d+)x(\d+)\+(-?\d+)\+(-?\d+)", geom
)
28 width
, height
, x
, y
= map(int, m
.groups())
29 newheight
= top
.winfo_screenheight()
30 if sys
.platform
== 'win32':
32 newheight
= newheight
- 72
34 elif macosxSupport
.runningAsOSXApp():
35 # The '88' below is a magic number that avoids placing the bottom
36 # of the window below the panel on my machine. I don't know how
37 # to calculate the correct value for this with tkinter.
39 newheight
= newheight
- newy
- 88
44 #newheight = newheight - 96
45 newheight
= newheight
- 88
46 if height
>= newheight
:
49 newgeom
= "%dx%d+%d+%d" % (width
, newheight
, x
, newy
)
50 top
.wm_geometry(newgeom
)