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


Python wintypes._COORD屬性代碼示例

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


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

示例1: SetConsoleCursorPosition

# 需要導入模塊: from ctypes import wintypes [as 別名]
# 或者: from ctypes.wintypes import _COORD [as 別名]
def SetConsoleCursorPosition(stream_id, position):
        position = wintypes._COORD(*position)
        # If the position is out of range, do nothing.
        if position.Y <= 0 or position.X <= 0:
            return
        # Adjust for Windows' SetConsoleCursorPosition:
        #    1. being 0-based, while ANSI is 1-based.
        #    2. expecting (x,y), while ANSI uses (y,x).
        adjusted_position = wintypes._COORD(position.Y - 1, position.X - 1)
        # Adjust for viewport's scroll position
        sr = GetConsoleScreenBufferInfo(STDOUT).srWindow
        adjusted_position.Y += sr.Top
        adjusted_position.X += sr.Left
        # Resume normal processing
        handle = handles[stream_id]
        return _SetConsoleCursorPosition(handle, adjusted_position) 
開發者ID:SrikanthVelpuri,項目名稱:tf-pose,代碼行數:18,代碼來源:win32.py

示例2: setup_console

# 需要導入模塊: from ctypes import wintypes [as 別名]
# 或者: from ctypes.wintypes import _COORD [as 別名]
def setup_console(self):
        if self.headless:
            self.console = Console(record=True)
            if self.os == 'Windows':
                window = windll.kernel32.GetConsoleWindow()
                if window:
                    windll.user32.ShowWindow(window, 0)
        elif 'WINDIR' in os.environ and 'WT_SESSION' not in os.environ:
            set_terminal_size(100, 50)
            windll.kernel32.SetConsoleScreenBufferSize(windll.kernel32.GetStdHandle(-11), wintypes._COORD(100, 200))
            self.console = Console(width=97)
        elif self.os == 'Darwin':
            set_terminal_size(100, 50)
            self.console = Console()
        else:
            self.console = Console() 
開發者ID:AcidWeb,項目名稱:CurseBreaker,代碼行數:18,代碼來源:CurseBreaker.py


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