■ ■ ■ ■ ■ ■
stackexplain/utilities/printers.py
| 1 | + | import sys |
1 | 2 | | from itertools import cycle |
2 | 3 | | from shutil import get_terminal_size |
3 | 4 | | from threading import Thread |
4 | 5 | | from time import sleep |
| 6 | + | from random import random |
5 | 7 | | |
6 | 8 | | # ASCII color codes |
7 | 9 | | GREEN = '\033[92m' |
| skipped 70 lines |
78 | 80 | | # handle exceptions with those variables ^ |
79 | 81 | | self.stop() |
80 | 82 | | |
| 83 | + | |
| 84 | + | def print_error_explanation(explanation): |
| 85 | + | for word in f"{explanation}\n": |
| 86 | + | sys.stdout.write(word) |
| 87 | + | sys.stdout.flush() # Defeat buffering |
| 88 | + | sleep(0.01) |
| 89 | + | |