當前位置: 首頁>>代碼示例>>Python>>正文


Python win32gui.ClientToScreen方法代碼示例

本文整理匯總了Python中win32gui.ClientToScreen方法的典型用法代碼示例。如果您正苦於以下問題:Python win32gui.ClientToScreen方法的具體用法?Python win32gui.ClientToScreen怎麽用?Python win32gui.ClientToScreen使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在win32gui的用法示例。


在下文中一共展示了win32gui.ClientToScreen方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: mouse_drag

# 需要導入模塊: import win32gui [as 別名]
# 或者: from win32gui import ClientToScreen [as 別名]
def mouse_drag(self, pos1, pos2):
        """
        鼠標拖拽
            :param pos1: (x,y) 起點坐標
            :param pos2: (x,y) 終點坐標
        """
        pos1_s = win32gui.ClientToScreen(self.hwnd, pos1)
        pos2_s = win32gui.ClientToScreen(self.hwnd, pos2)
        screen_x = win32api.GetSystemMetrics(win32con.SM_CXSCREEN)
        screen_y = win32api.GetSystemMetrics(win32con.SM_CYSCREEN)
        start_x = pos1_s[0]*65535//screen_x
        start_y = pos1_s[1]*65535//screen_y
        dst_x = pos2_s[0]*65535//screen_x
        dst_y = pos2_s[1]*65535//screen_y
        move_x = np.linspace(start_x, dst_x, num=20, endpoint=True)[0:]
        move_y = np.linspace(start_y, dst_y, num=20, endpoint=True)[0:]
        self.mouse_move(pos1)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
        for i in range(20):
            x = int(round(move_x[i]))
            y = int(round(move_y[i]))
            win32api.mouse_event(win32con.MOUSEEVENTF_MOVE |
                                 win32con.MOUSEEVENTF_ABSOLUTE, x, y, 0, 0)
            time.sleep(0.01)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0) 
開發者ID:AcademicDog,項目名稱:onmyoji_bot,代碼行數:27,代碼來源:game_ctl.py

示例2: tap

# 需要導入模塊: import win32gui [as 別名]
# 或者: from win32gui import ClientToScreen [as 別名]
def tap(self, x, y):
        if self.run_time.stop:
            return
        x, y = int(x), int(y)
        self.root.debug("Tapping at location ({},{})".format(x, y))
        if self._debug:
            # Helper to debug taps
            input("waiting for confirmation press enter")
        ox, oy = win32api.GetCursorPos()
        curr_window = win32gui.GetForegroundWindow()
        win32gui.ShowWindow(self.win_handle, win32con.SW_RESTORE)
        x, y = int(x), int(y)
        cx, cy = win32gui.ClientToScreen(self.win_handle, (x, y))
        x, y = self.__calculate_absolute_coordinates__(cx, cy)
        win32api.mouse_event(win32con.MOUSEEVENTF_MOVE | win32con.MOUSEEVENTF_ABSOLUTE,
                             x, y, 0, 0)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y, 0, 0)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y, 0, 0)
        time.sleep(20 / 1000)
        win32api.SetCursorPos((ox, oy))
        win32gui.SetActiveWindow(curr_window) 
開發者ID:will7200,項目名稱:Yugioh-bot,代碼行數:23,代碼來源:steam.py

示例3: OnInitDialog

# 需要導入模塊: import win32gui [as 別名]
# 或者: from win32gui import ClientToScreen [as 別名]
def OnInitDialog(self, hwnd, msg, wparam, lparam):
        self.hwnd = hwnd
        # centre the dialog
        desktop = win32gui.GetDesktopWindow()
        l,t,r,b = win32gui.GetWindowRect(self.hwnd)
        dt_l, dt_t, dt_r, dt_b = win32gui.GetWindowRect(desktop)
        centre_x, centre_y = win32gui.ClientToScreen( desktop, ( (dt_r-dt_l)//2, (dt_b-dt_t)//2) )
        win32gui.MoveWindow(hwnd, centre_x-(r//2), centre_y-(b//2), r-l, b-t, 0)
        self._SetupList()
        l,t,r,b = win32gui.GetClientRect(self.hwnd)
        self._DoSize(r-l,b-t, 1) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:13,代碼來源:win32gui_dialog.py

示例4: OnInitDialog

# 需要導入模塊: import win32gui [as 別名]
# 或者: from win32gui import ClientToScreen [as 別名]
def OnInitDialog(self, hwnd, msg, wparam, lparam):
        self.hwnd = hwnd
        # centre the dialog
        desktop = win32gui.GetDesktopWindow()
        l,t,r,b = win32gui.GetWindowRect(self.hwnd)
        dt_l, dt_t, dt_r, dt_b = win32gui.GetWindowRect(desktop)
        centre_x, centre_y = win32gui.ClientToScreen( desktop, ( (dt_r-dt_l)//2, (dt_b-dt_t)//2) )
        win32gui.MoveWindow(hwnd, centre_x-(r//2), centre_y-(b//2), r-l, b-t, 0) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:10,代碼來源:win32rcparser_demo.py

示例5: rect

# 需要導入模塊: import win32gui [as 別名]
# 或者: from win32gui import ClientToScreen [as 別名]
def rect(self):
        hwnd = self.hwnd
        if not self.exclude_border:
            left, top, right, bottom = win32gui.GetWindowRect(hwnd)
        else:
            _left, _top, _right, _bottom = win32gui.GetClientRect(hwnd)
            left, top = win32gui.ClientToScreen(hwnd, (_left, _top))
            right, bottom = win32gui.ClientToScreen(hwnd, (_right, _bottom))
        return Rect(left, top, right, bottom) 
開發者ID:NetEaseGame,項目名稱:ATX,代碼行數:11,代碼來源:windows.py

示例6: __init_rect_size

# 需要導入模塊: import win32gui [as 別名]
# 或者: from win32gui import ClientToScreen [as 別名]
def __init_rect_size(self):
        hwnd = self.hwnd
        left, top, right, bottom = win32gui.GetWindowRect(hwnd)
        if self.exclude_border:
            _left, _top, _right, _bottom = win32gui.GetClientRect(hwnd)
            left, top = win32gui.ClientToScreen(hwnd, (_left, _top))
            right, bottom = win32gui.ClientToScreen(hwnd, (_right, _bottom))
        self._rect = Rect(left, top, right, bottom)
        self._size = Size(right-left, bottom-top) 
開發者ID:NetEaseGame,項目名稱:ATX,代碼行數:11,代碼來源:windows.py

示例7: mouse_move

# 需要導入模塊: import win32gui [as 別名]
# 或者: from win32gui import ClientToScreen [as 別名]
def mouse_move(self, pos, pos_end=None):
        """
        模擬鼠標移動
            :param pos: (x,y) 鼠標移動的坐標
            :param pos_end=None: (x,y) 若pos_end不為空,則鼠標移動至以pos為左上角坐標pos_end為右下角坐標的區域內的隨機位置
        """
        pos2 = win32gui.ClientToScreen(self.hwnd, pos)
        if pos_end == None:
            win32api.SetCursorPos(pos2)
        else:
            pos_end2 = win32gui.ClientToScreen(self.hwnd, pos_end)
            pos_rand = (random.randint(
                pos2[0], pos_end2[0]), random.randint(pos2[1], pos_end2[1]))
            win32api.SetCursorPos(pos_rand) 
開發者ID:AcademicDog,項目名稱:onmyoji_bot,代碼行數:16,代碼來源:game_ctl.py

示例8: OnInitDialog

# 需要導入模塊: import win32gui [as 別名]
# 或者: from win32gui import ClientToScreen [as 別名]
def OnInitDialog(self, hwnd, msg, wparam, lparam):
        self.hwnd = hwnd
        # centre the dialog
        desktop = win32gui.GetDesktopWindow()
        l, t, r, b = win32gui.GetWindowRect(self.hwnd)
        dt_l, dt_t, dt_r, dt_b = win32gui.GetWindowRect(desktop)
        centre_x, centre_y = win32gui.ClientToScreen(desktop, (
            (dt_r - dt_l) // 2, (dt_b - dt_t) // 2))
        win32gui.MoveWindow(hwnd, centre_x - (r // 2), centre_y - (b // 2),
                            r - l, b - t, 0)
        # self._SetupList()
        l, t, r, b = win32gui.GetClientRect(self.hwnd)
        self._DoSize(r - l, b - t, 1) 
開發者ID:eavatar,項目名稱:eavatar-me,代碼行數:15,代碼來源:console.py

示例9: OnInitDialog

# 需要導入模塊: import win32gui [as 別名]
# 或者: from win32gui import ClientToScreen [as 別名]
def OnInitDialog(self, hwnd, msg, wparam, lparam):
        self.hwnd = hwnd
        # centre the dialog
        desktop = win32gui.GetDesktopWindow()
        l, t, r, b = win32gui.GetWindowRect(self.hwnd)
        dt_l, dt_t, dt_r, dt_b = win32gui.GetWindowRect(desktop)
        centre_x, centre_y = win32gui.ClientToScreen(desktop,
                                                     ((dt_r - dt_l)//2,
                                                      (dt_b - dt_t)//2))
        win32gui.MoveWindow(hwnd, centre_x-(r//2),
                            centre_y-(b//2), r-l, b-t, 0)
        # self._SetupList()
        l, t, r, b = win32gui.GetClientRect(self.hwnd)
        self._DoSize(r-l, b-t, 1) 
開發者ID:eavatar,項目名稱:eavatar-me,代碼行數:16,代碼來源:notice_dlg.py

示例10: OnInitDialog

# 需要導入模塊: import win32gui [as 別名]
# 或者: from win32gui import ClientToScreen [as 別名]
def OnInitDialog(self, hwnd, msg, wparam, lparam):
        self.hwnd = hwnd
        # centre the dialog
        desktop = win32gui.GetDesktopWindow()
        l, t, r, b = win32gui.GetWindowRect(self.hwnd)
        dt_l, dt_t, dt_r, dt_b = win32gui.GetWindowRect(desktop)
        centre_x, centre_y = win32gui.ClientToScreen(
            desktop,
            ((dt_r-dt_l)//2, (dt_b-dt_t)//2))
        win32gui.MoveWindow(hwnd, centre_x-(r//2),
                            centre_y-(b//2), r-l, b-t, 0)
        # self._SetupList()
        l, t, r, b = win32gui.GetClientRect(self.hwnd)
        self._DoSize(r-l, b-t, 1) 
開發者ID:eavatar,項目名稱:eavatar-me,代碼行數:16,代碼來源:simpledialog.py


注:本文中的win32gui.ClientToScreen方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。