The screenshot in your post shows the classic console (terminal) window that’s used by the Windows operating system. This window gets created by the host process of a console session, “conhost.exe”. Nowadays a console session can also be hosted by an instance of “openconsole.exe” that’s associated with a tab in Windows Terminal. In Windows 11, users can select Windows Terminal as their default terminal.
A console or terminal reads keyboard input and displays text on a screen (and possibly one or more alternate screens). Usually the default background color of a console or terminal is black, but a user can configure a different default background color. On Windows, a console also provides mouse input events and window-size events directly to applications via the low-level ReadConsoleInputW()
function.
A console or terminal is commonly used to implement a command-line interface (CLI), such as the CMD shell, PowerShell, or Python’s interactive shell (i.e. Python’s interactive read-eval-print loop, or REPL). A console or terminal can also implement a text user interface (TUI), such as for text editors like vim or nano.
By default, a console application such as “python.exe” either inherits or allocates a console session. By default, standard input in a Python console application is read from a console input file, including at the prompt of the interactive shell, builtin input()
, and sys.stdin.read()
. By default, standard output and standard error in a Python console application are written to a console output file, including output in the interactive shell, builtin print()
, sys.stdout.write()
, and sys.stderr.write()
.
If you don’t want your script to have a console, run “pythonw.exe” instead of “python.exe”. In this case, if you need a user interface, you’ll have to implement it yourself using a GUI toolkit such as tkinter, pyqt, etc. “pythonw.exe” is also good for running background processes that have no user interface.