You will need to provide some specifics of what you are using the
methods for but there are platform independent methods in wx itself
that perform the same task (depending upon the usage).
On Mon, Nov 29, 2010 at 12:56 PM, Fahri <mang...@gmail.com> wrote:
> Hi,
>
> I am porting a windows wxPython application to Mac OSX. Windows
> version uses two win32gui methods.
>
> Here are the methods I need:
>
> win32gui.GetActiveWindow()
app = wx.GetApp()
app.GetTopWindow()
> win32gui.EnumWindows(winHandler, topWindows)
windowList = wx.GetTopLevelWindows()
Cody
What are you using them for? Perhaps there is a wx way to do it that
would not require calling native APIs. For example, to find the active
frame in your application this would probably work:
for win in wx.GetTopLevelWindows():
if win.IsActive():
return win
return None
>
> Any documentation performing these tasks on a Mac?
If you can find the API you need then you can use ctypes to call
functions in the Carbon library. I expect that PyObjC could be used to
call Cocoa methods in a Cocoa build of wx, but I've never tried it.
--
Robin Dunn
Software Craftsman
http://wxPython.org
That isn't the same. GetTopWindow only returns the window you passed to
SetTopWindow, or the first top-level window created if SetTopWindow
wasn't called. If there is more than one top-level window in the
application then that one may or may not be the active one.
That may not be an issue on the Mac as you should not have multiple
instances of your application running. Instead Mac applications will
typically have one or more document windows (wx.Frames) open, all of
them running in the same process.
Forgot about that as I usually have a OnActivate handling in my base
toplevel window class that calls SetTopWindow.
Something along the following lines could be equivalent if the usage
is app centric:
def GetActiveWindow():
for win in wx.GetTopLevelWindows():
if getattr(win, 'IsActive', lamba:False)():
return win
Cody