ansiterm.py 文件源码

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

项目:SoCFoundationFlow 作者: mattaw 项目源码 文件源码
def clear_screen(self, param):
            mode = to_int(param, 0)
            sbinfo = self.screen_buffer_info()
            if mode == 1: # Clear from begining of screen to cursor position
                clear_start = COORD(0, 0)
                clear_length = sbinfo.CursorPosition.X * sbinfo.CursorPosition.Y
            elif mode == 2: # Clear entire screen and return cursor to home
                clear_start = COORD(0, 0)
                clear_length = sbinfo.Size.X * sbinfo.Size.Y
                windll.kernel32.SetConsoleCursorPosition(self.hconsole, clear_start)
            else: # Clear from cursor position to end of screen
                clear_start = sbinfo.CursorPosition
                clear_length = ((sbinfo.Size.X - sbinfo.CursorPosition.X) + sbinfo.Size.X * (sbinfo.Size.Y - sbinfo.CursorPosition.Y))
            chars_written = c_ulong()
            windll.kernel32.FillConsoleOutputCharacterW(self.hconsole, c_wchar(' '), clear_length, clear_start, byref(chars_written))
            windll.kernel32.FillConsoleOutputAttribute(self.hconsole, sbinfo.Attributes, clear_length, clear_start, byref(chars_written))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号