win_GUI.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:Automation-Framework-for-devices 作者: tok-gogogo 项目源码 文件源码
def findTopWindow(self,wantedText=None, wantedClass=None, selectionFunction=None):
        '''Find the hwnd of a top level window.
        You can identify windows using captions, classes, a custom selection
        function, or any combination of these. (Multiple selection criteria are
        ANDed. If this isn't what's wanted, use a selection function.)

        Arguments:
        wantedText          Text which the required window's captions must contain.
        wantedClass         Class to which the required window must belong.
        selectionFunction   Window selection function. Reference to a function
                            should be passed here. The function should take hwnd as
                            an argument, and should return True when passed the
                            hwnd of a desired window.

        Raises:
        WinGuiAutoError     When no window found.

        Usage example:      optDialog = findTopWindow(wantedText="Options")
        '''
        topWindows = self.findTopWindows(wantedText, wantedClass, selectionFunction)
        if topWindows:
            win32gui.MoveWindow(topWindows[0],0,0,self.wdx,self.wdy,1)
            return topWindows[0]
        else:
            raise WinGuiAutoError("No top level window found for wantedText=" +
                                repr(wantedText) +
                                ", wantedClass=" +
                                repr(wantedClass) +
                                ", selectionFunction=" +
                                repr(selectionFunction))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号