Identifying foreground window?

If I have two windows (say, frames) open, is there a way to determine
which of them is in the foreground and which is in the background?
I've tried IsActive, HasCapture, IsTopLevel, IsExposed, and a bunch of
other things, but nothing seems to distinguish between front and back
windows.

MacOS10.4.9, Python2.4, wxPython2.8.3.

Ian

···

--
Ian York (iayork@gmail.com) <http://www.panix.com/~iayork/>
    "-but as he was a York, I am rather inclined to suppose him a
     very respectable Man." -Jane Austen, The History of England