/
a.py
52 lines (46 loc) · 1.49 KB
/
a.py
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
import curses
def notify_resize(scr):
origy, origx = scr.getyx()
Y, X = scr.getmaxyx()
scr.addstr("scr is resized to (y=%d, x=%d)\n" % (Y ,X))
#scr.hline(Y-1, 0, curses.ACS_HLINE, X)
scr.hline(Y-40, 0, '-', X)
scr.move(origy, origx)
return (Y ,X)
def foo(scr):
#notify_resize(scr)
scr.scrollok(True)
maxy, maxx = scr.getmaxyx()
win = scr.subwin(1, maxx, maxy-1, 0)
win.overwrite(scr)
win.addstr('1')
win.clear()
while True:
key = scr.getch()
if key == curses.KEY_RESIZE:
#notify_resize(scr)
pass
else:
try:
#scr.addstr(str(curses.keyname(key)) + "\t: ",
win.addstr('2')
#win.clear()
scr.addstr(curses.keyname(key) + "\t: ",
#curses.A_BLINK)
#curses.A_BOLD)
#curses.A_NORMAL)
curses.A_REVERSE)
#curses.A_STANDOUT)
#curses.A_UNDERLINE)
#scr.addstr(str(key) + "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n\n", curses.A_REVERSE)
scr.addstr(str(key) + "\n", curses.A_REVERSE)
scr.refresh()
except:
scr.scroll()
win.addstr(curses.keyname(key))
win.refresh()
try:
curses.wrapper(foo)
except KeyboardInterrupt:
pass
# vim: set tw=80 ts=4 et sw=4 fdm=indent: ###################### vim modeline #