How to bring back a frame to foreground even if the app don't have the focus

Hello list!

Is there a way to bring back a frame to the foreground even if the wx
application doesn't have the focus anymore?

(The reason the application has not the focus anymore is that the user
use an application like powerpoint in the foreground)

I tried things like:

frameEnd.Show()
frameEnd.SetFocus()
frameEnd.Raise()
frameEnd.UpdateWindowUI()

If it's not possible is there another way to do it on OSX Lion (on the
Windows version i used Pywinauto to get around) ?

Thanks
francois

If it's going to work then Raise would do it, however most platforms these days will try to block raising a frame while another application is active. Instead they provide a way to tell the user that the frame should be raised manually, which you can use with frame.RequestUserAttention()

···

On 11/16/11 7:25 AM, francois wrote:

Hello list!

Is there a way to bring back a frame to the foreground even if the wx
application doesn't have the focus anymore?

(The reason the application has not the focus anymore is that the user
use an application like powerpoint in the foreground)

I tried things like:

frameEnd.Show()
frameEnd.SetFocus()
frameEnd.Raise()
frameEnd.UpdateWindowUI()

--
Robin Dunn
Software Craftsman

Thanks Robin! :slight_smile:

I'm using the RequestUserAttention() in addition to this code which
brings the window back to foreground whatever other applications are
in front:

def go_foreground():
    from AppKit import NSApp, NSApplication
    NSApplication.sharedApplication()
    NSApp().activateIgnoringOtherApps_(True)
go_foreground()

Source:

···

On Nov 16, 8:09 pm, Robin Dunn <ro...@alldunn.com> wrote:

On 11/16/11 7:25 AM, francois wrote:

> Hello list!

> Is there a way to bring back a frame to the foreground even if the wx
> application doesn't have the focus anymore?

> (The reason the application has not the focus anymore is that the user
> use an application like powerpoint in the foreground)

> I tried things like:

> frameEnd.Show()
> frameEnd.SetFocus()
> frameEnd.Raise()
> frameEnd.UpdateWindowUI()

If it's going to work then Raise would do it, however most platforms
these days will try to block raising a frame while another application
is active. Instead they provide a way to tell the user that the frame
should be raised manually, which you can use with
frame.RequestUserAttention()

--
Robin Dunn
Software Craftsmanhttp://wxPython.org