osx - Getting a window to the top in wxPython for Mac -


i have app lives in tray, , i'm trying show/hide when click menu item in tray menu. code works, window shows behind other windows, instead of on top should. (note, don't want always-on-top, pop top of window stack.)

it seems work on windows fine, on mac stays below whatever other windows have been pulled in front of in mean time.

the relevant code below.

def on_hide_frame(self, event):     self.frame.on_iconify(event)  def on_restore_frame(self, event):     if self.frame.isiconized():         self.frame.iconize(false)     if not self.frame.isshown():         self.frame.show(true)     self.frame.raise() 

also note that, when called, self.frame same object app.gettopwindow() , interchanging 2 not fix bug.

it seems cause app background app, , needs activate event. may not best way, it's easy send activate event using applescript:

subprocess.popen(['osascript', '-e', '''\     tell application "system events"       set procname name of first process unix id %s     end tell     tell application procname activate ''' % os.getpid()]) 

Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -