tweak the example to print region bounding box

This commit is contained in:
Jeff Epler 2025-07-31 16:25:58 -05:00
parent e188517863
commit b7b5d9db06

View file

@ -23,30 +23,15 @@ ev = eventmgr.EventRecord()
NIL_WINDOW = uctypes.struct(0, qd.GrafPtr)
ABOVE_ALL_WINDOWS = uctypes.struct(-1, qd.GrafPtr)
print(f"{ABOVE_ALL_WINDOWS=}")
title = pstr("Hello World 11")
r = mactypes.Rect()
r[:] = scrn.bounds
r.top += 80
r.left += 100
qd.InsetRect(r, 25, 25)
w = windowmgr.NewWindow(NIL_WINDOW, r, title, True, 0, ABOVE_ALL_WINDOWS, True, 0)
print(f"{w=}")
print(f"{w.portRect.left=}")
print(f"{w.portRect.right=}")
# print("before setport")
qd.SetPort(w)
# print("33")
# print(type(r))
# print(r)
# print(f"{w}")
# print(f"{w.portRect}")
# print(f"{w.portRect.top}")
# print(f"{w.portRect.left}")
r[:] = w.portRect
print(r.left, r.right)
print(r.top, r.bottom)
g = qd.qdGlobals()
@ -61,6 +46,8 @@ qd.SetRect(tempRect, 80, 20, 90, 50)
qd.FrameOval(tempRect)
qd.CloseRgn(barbell)
r[:] = barbell[0].rgnBBox
print(f"region size {barbell[0].rgnSize} bbox {r.top},{r.left}..{r.right},{r.bottom}")
qd.FillRgn(barbell, g.black)
qd.DisposeRgn(barbell)