(self, new=True)
Bring a window into focus.
        Kept the old way just to be on the safe side.
Bring a window into focus.
        Kept the old way just to be on the safe side.
Bring a window into focus . Kept the old way just to be on the safe side .
def bring_to_front(self, new=True):
        """Bring a window into focus.
        Kept the old way just to be on the safe side.
        """
        if new:
            win32gui.ShowWindow(self.hwnd, True)
        else:
            self.restore()
            
        #Sometimes it seems to fail but then work a second time
        try:
            win32gui.SetForegroundWindow(self.hwnd)
        except pywintypes.error:
            time.sleep(0.5)
            win32gui.ShowWindow(self.hwnd, True)
            try:
                win32gui.SetForegroundWindow(self.hwnd)
            except pywintypes.error:
                pass
def bring_to_front ( self , new = True ) : if new : win32gui . ShowWindow ( self . hwnd , True ) else : self . restore ( ) #Sometimes it seems to fail but then work a second time try : win32gui . SetForegroundWindow ( self . hwnd ) except pywintypes . error : time . sleep ( 0.5 ) win32gui . ShowWindow ( self . hwnd , True ) try : win32gui . SetForegroundWindow ( self . hwnd ) except pywintypes . error : pass