Skip to content

Commit f5159c4

Browse files
committed
added functions and ready for test
1 parent 28c84bb commit f5159c4

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

‎example/curses/border.py‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@
33
Testing out the curses lib.
44
"""
55

6-
#from curses import wrapper
76
import curses
87

98

109
def main(scr):
1110
"""
12-
Draw a border around the screen.
11+
Draw a border around the screen, move around using the cursor and leave a mark
12+
of the latest pressed character on the keyboard.
13+
14+
Perhaps you could make a nice painting using asciart?
15+
16+
Quit using 'q'.
1317
"""
1418
# Clear the screen of any output
1519
scr.clear()
@@ -51,16 +55,19 @@ def main(scr):
5155
else:
5256
ch = key
5357

54-
# As long as key was not spacebar - draw out the char at cursor
55-
if ch != ' ':
56-
scr.addstr(ch)
58+
# Draw out the char at cursor positino
59+
scr.addstr(ch)
5760

5861
# Move cursor to new position
5962
scr.move(y, x)
6063

64+
# Redraw all items on the screen
6165
scr.refresh()
6266

6367

68+
6469
if __name__ == "__main__":
70+
print(__doc__)
6571
print(main.__doc__)
72+
input("Press enter to begin playing...")
6673
curses.wrapper(main)

0 commit comments

Comments
 (0)