当前位置: 首页>>代码示例>>Python>>正文


Python win32console.PyCOORDType方法代码示例

本文整理汇总了Python中win32console.PyCOORDType方法的典型用法代码示例。如果您正苦于以下问题:Python win32console.PyCOORDType方法的具体用法?Python win32console.PyCOORDType怎么用?Python win32console.PyCOORDType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在win32console的用法示例。


在下文中一共展示了win32console.PyCOORDType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _print_at

# 需要导入模块: import win32console [as 别名]
# 或者: from win32console import PyCOORDType [as 别名]
def _print_at(self, text, x, y, width):
            """
            Print string at the required location.

            :param text: The text string to print.
            :param x: The x coordinate
            :param y: The Y coordinate
            :param width: The width of the character (for dual-width glyphs in CJK languages).
            """
            # We can throw temporary errors on resizing, so catch and ignore
            # them on the assumption that we'll resize shortly.
            try:
                # Move the cursor if necessary
                if x != self._cur_x or y != self._cur_y:
                    self._stdout.SetConsoleCursorPosition(
                        win32console.PyCOORDType(x, y))

                # Print the text at the required location and update the current
                # position.
                self._stdout.WriteConsole(text)
                self._cur_x = x + width
                self._cur_y = y
            except pywintypes.error:
                pass 
开发者ID:peterbrittain,项目名称:asciimatics,代码行数:26,代码来源:screen.py

示例2: _scroll

# 需要导入模块: import win32console [as 别名]
# 或者: from win32console import PyCOORDType [as 别名]
def _scroll(self, lines):
            """
            Scroll the window up or down.

            :param lines: Number of lines to scroll.  Negative numbers scroll
                down.
            """
            # Scroll the visible screen up by one line
            info = self._stdout.GetConsoleScreenBufferInfo()['Window']
            rectangle = win32console.PySMALL_RECTType(
                info.Left, info.Top + lines, info.Right, info.Bottom)
            new_pos = win32console.PyCOORDType(0, info.Top)
            self._stdout.ScrollConsoleScreenBuffer(
                rectangle, None, new_pos, " ", 0) 
开发者ID:peterbrittain,项目名称:asciimatics,代码行数:16,代码来源:screen.py

示例3: _clear

# 需要导入模块: import win32console [as 别名]
# 或者: from win32console import PyCOORDType [as 别名]
def _clear(self):
            """
            Clear the terminal.
            """
            info = self._stdout.GetConsoleScreenBufferInfo()['Window']
            width = info.Right - info.Left + 1
            height = info.Bottom - info.Top + 1
            box_size = width * height
            self._stdout.FillConsoleOutputAttribute(
                0, box_size, win32console.PyCOORDType(0, 0))
            self._stdout.FillConsoleOutputCharacter(
                " ", box_size, win32console.PyCOORDType(0, 0))
            self._stdout.SetConsoleCursorPosition(
                win32console.PyCOORDType(0, 0)) 
开发者ID:peterbrittain,项目名称:asciimatics,代码行数:16,代码来源:screen.py

示例4: _ClearScreen

# 需要导入模块: import win32console [as 别名]
# 或者: from win32console import PyCOORDType [as 别名]
def _ClearScreen(self):
    """Clears the terminal/console screen."""
    if self._have_ansi_support:
      # ANSI escape sequence to clear screen.
      self._output_writer.Write('\033[2J')
      # ANSI escape sequence to move cursor to top left.
      self._output_writer.Write('\033[H')

    elif win32console:
      # This version of Windows cmd.exe does not support ANSI escape codes, thus
      # instead we fill the console screen buffer with spaces. The downside of
      # this approach is an annoying flicker.
      top_left_coordinate = win32console.PyCOORDType(0, 0)
      screen_buffer = win32console.GetStdHandle(win32api.STD_OUTPUT_HANDLE)
      screen_buffer_information = screen_buffer.GetConsoleScreenBufferInfo()

      screen_buffer_attributes = screen_buffer_information['Attributes']
      screen_buffer_size = screen_buffer_information['Size']
      console_size = screen_buffer_size.X * screen_buffer_size.Y

      screen_buffer.FillConsoleOutputCharacter(
          ' ', console_size, top_left_coordinate)
      screen_buffer.FillConsoleOutputAttribute(
          screen_buffer_attributes, console_size, top_left_coordinate)
      screen_buffer.SetConsoleCursorPosition(top_left_coordinate)

      # TODO: remove update flicker. For win32console we could set the cursor
      # top left, write the table, clean the remainder of the screen buffer
      # and set the cursor at the end of the table. 
开发者ID:log2timeline,项目名称:plaso,代码行数:31,代码来源:status_view.py


注:本文中的win32console.PyCOORDType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。