10 examples of 'clear screen python' in Python

Every line of 'clear screen python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
29def clear_screen():
30 if os.name == "nt":
31 os.system("cls")
32 else:
33 sys.stdout.write("\x1b[2J\x1b[H")
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

26def clear_screen(stdscr):
27 stdscr.clear()
28 stdscr.refresh()
43def clearScreen():
44 if not _Stdscr:
45 _initCurses()
46
47 _Stdscr.clear()
1383def clear(self):
1384 """
1385 Clear the Screen of all content.
1386
1387 Note that this will instantly clear the Screen and reset all buffers to the default state,
1388 without waiting for you to call :py:meth:`~.Screen.refresh`.
1389 """
1390 # Clear the actual terminal
1391 self.reset()
1392 self._change_colours(Screen.COLOUR_WHITE, 0, 0)
1393 self._clear()
101def clear(self):
102 """Refresh all windows"""
103 self.stdscr.erase()
104 if self.data_win:
105 self.data_win.erase()
106 if self.map_win:
107 self.map_win.erase()
108 if self.path_win:
109 self.path_win.erase()
110 if self.log_win:
111 self.log_win.erase()
112 if self.help_win:
113 self.help_win.erase()
114 if self.players_win:
115 self.players_win.erase()
116 if self.time_win:
117 self.time_win.erase()
118 if self.summary_win:
119 self.summary_win.erase()
120 if self.menu_win:
121 self.menu_win.erase()
122 curses.doupdate()
160def clear(self): # From kb q99261
161 rp = COORD()
162 wr = DWORD()
163 csbi = CONSOLE_SCREEN_BUFFER_INFO()
164 GetConsoleScreenBufferInfo(self.stdout_handle, byref(csbi))
165 sx = csbi.dwSize.X * csbi.dwSize.Y
166
167 FillConsoleOutputCharacter(self.stdout_handle, 32,
168 sx, rp, byref(wr))
169 FillConsoleOutputAttribute(self.stdout_handle, csbi.wAttributes,
170 sx, rp, byref(wr))
84def clear_screen(_input=sys.stdin, _output=sys.stdout):
85 """Clear terminal screen."""
86
87 if not _output.isatty():
88 return
89
90 cmd = 'cls' if os.name == 'nt' else 'clear'
91 subprocess.call(cmd, shell=True, stdin=_input, stdout=_output, stderr=_output)
300def clear(self):
301 buffer = self.textView.get_buffer()
302 buffer.delete(*buffer.get_bounds())
197async def clear_screen():
198 # instead of "clearing", we're actually just overwriting
199 # everything with white space. This mitigates the massive
200 # screen flashing that goes on with "cls" and "clear"
201 del screen_buffer[:]
202 wipe = (" " * (gc.term.width) + "\n") * gc.term.height
203 print(gc.term.move(0,0) + wipe, end="")
201def clear(button):
202 self.aqu_task.cancel()
203 graph.clear()

Related snippets