-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex_xyprintf.py
More file actions
63 lines (44 loc) · 1.83 KB
/
ex_xyprintf.py
File metadata and controls
63 lines (44 loc) · 1.83 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
def my_program():
clear_screen()
xyprintf(5, 5, 'This is how xyprintf prints')
xyprintf(0, 0, 'Origin is at the bottom left')
xyprintf(13, 20, "Text doesn't wrap at the end of the line ")
printf(color='light-yellow')
xyprintf(1, 23, 'To print in colors, use a trick')
###########################################################################
###########################################################################
# 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)
###########################################################################
###########################################################################