Exemplo n.º 1
0
 def get_parent(self):
     """
     @see:    L{get_children}
     @rtype:  L{Window} or None
     @return: Parent window. Returns C{None} if the window has no parent.
     @raise WindowsError: An error occured while processing this request.
     """
     hWnd = win32.GetParent( self.get_handle() )
     if hWnd:
         return self.__get_window(hWnd)
Exemplo n.º 2
0
 def get_root(self):
     """
     @see:    L{get_tree}
     @rtype:  L{Window}
     @return: If this is a child window, return the top-level window it
         belongs to.
         If this window is already a top-level window, returns itself.
     @raise WindowsError: An error occured while processing this request.
     """
     hWnd     = self.get_handle()
     history  = set()
     hPrevWnd = hWnd
     while hWnd and hWnd not in history:
         history.add(hWnd)
         hPrevWnd = hWnd
         hWnd     = win32.GetParent(hWnd)
     if hWnd in history:
         # See: https://docs.google.com/View?id=dfqd62nk_228h28szgz
         return self
     if hPrevWnd != self.get_handle():
         return self.__get_window(hPrevWnd)
     return self