Debian Codegraph @

demos/demo05.py

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 #!/usr/bin/python
2 # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
3
4 # Demonstrate the difference between colorama initialized with wrapping on and off.
5 # The point of the demonstration is to show how the ANSI wrapping on Windows can be disabled.
6 # The unwrapped cases will be interpreted with ANSI on Unix, but not on Windows.
7
8 from __future__ import print_function
9 import sys
10 import fixpath
11 from colorama import AnsiToWin32, init, Fore
12
13 init()
14 print('%sWrapped yellow going to stdout, via the default print function.' % Fore.YELLOW)
15
16 init(wrap=False)
17 print('%sUnwrapped CYAN going to stdout, via the default print function.' % Fore.CYAN)
18 print('%sUnwrapped CYAN, using the file parameter to write via colorama the AnsiToWin32 function.' % Fore.CYAN, file=AnsiToWin32(sys.stdout))
19 print('%sUnwrapped RED going to stdout, via the default print function.' % Fore.RED)
20
21 init()
22 print('%sWrapped RED going to stdout, via the default print function.' % Fore.RED)