Are you talking about activating a window that you created in wx or in a separate application, for example, in notepad? If it is with wx, then it is trivial. You simply use Raise () to give the frame the focus you need. You would probably use PubSub or PostEvent so that the subframe knows what it needs to be raised.
, . , , PyWin32:
def windowEnumerationHandler(self, hwnd, resultList):
'''
This is a handler to be passed to win32gui.EnumWindows() to generate
a list of (window handle, window text) tuples.
'''
resultList.append((hwnd, win32gui.GetWindowText(hwnd)))
def bringToFront(self, windowText):
'''
Method to look for an open window that has a title that
matches the passed in text. If found, it will proceed to
attempt to make that window the Foreground Window.
'''
secondsPassed = 0
while secondsPassed <= 5:
wx.Sleep(1)
print 'bringing to front'
topWindows = []
win32gui.EnumWindows(self.windowEnumerationHandler, topWindows)
print len(topWindows)
for i in topWindows:
if windowText in i[1]:
print i[1]
win32gui.ShowWindow(i[0],5)
win32gui.SetForegroundWindow(i[0])
handle = win32gui.GetForegroundWindow()
if windowText in win32gui.GetWindowText(handle):
break
else:
secondsPassed += 1
SendKeys (. http://www.rutherfurd.net/python/sendkeys/). - , script - . - MS Office, win32com SendKeys. .