-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex_printf_options.py
More file actions
79 lines (53 loc) · 2.31 KB
/
ex_printf_options.py
File metadata and controls
79 lines (53 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
def my_program():
printf('Example of printf using a color number',color=17)
printf('And now using a color name', color='light-yellow')
printf()
printf('To leave a blank line, do not include anything inside the parenthesis', color='light-green')
printf()
printf('If no color is specified, printf will select color used last')
printf()
printf('After a printf ends, the next printf will continue in the next line',color='light-blue')
printf('Except when you specify otherwise...', stay=True)
printf('This time it stayed in the same line!!!',color='white')
printf()
printf('You can also print in reverse!!!', reverse=True, color='pink')
printf('Reversed spaces make fine lines!!!')
printf()
printf(' ', reverse=True)
###########################################################################
###########################################################################
# The next lines are needed to run compy, don't mind them,
# but keep them, don't get rid of these lines
###########################################################################
###########################################################################
import compy
import time
# define commands of compy, so IDE's will recognize them
def clear_screen(): pass
def set_bg_color(color): pass
def set_fm_color(color): pass
def printf(to_print='', color=None, stay=False, reverse=False): pass
def xyprintf(x, y, *args): pass
def poke(x, y, code, color = None, reverse=False): pass
def peek(self, x, y): pass
def input(message = '', color=None): return None
def wait_key(): pass
def check_key(): pass
def redefine_commands_and_run(screen):
global clear_screen, set_bg_color, set_fm_color, printf, xyprintf
global poke, peek, input, wait_key, check_key
clear_screen = screen.clear_screen
set_bg_color = screen.set_bg_color
set_fm_color = screen.set_fm_color
printf = screen.printf
xyprintf = screen.xyprintf
poke = screen.poke
peek = screen.peek
input = screen.input
wait_key = screen.wait_key
check_key = screen.check_key
my_program()
if __name__ == '__main__':
compy.run(redefine_commands_and_run)
###########################################################################
###########################################################################