iterating over each char in the file in a more pythonic way, though still not happy with retaining all of the branches from the C version
This commit is contained in:
parent
2cb096e27e
commit
996ade6414
@ -8,14 +8,16 @@ FILE = {'fp': None}
|
|||||||
def simple_attr(stdscr):
|
def simple_attr(stdscr):
|
||||||
row, col = stdscr.getmaxyx()
|
row, col = stdscr.getmaxyx()
|
||||||
prev = ''
|
prev = ''
|
||||||
for ch in FILE['fp'].read():
|
fp = FILE['fp']
|
||||||
|
for line in fp:
|
||||||
|
for ch in line:
|
||||||
y, x = stdscr.getyx()
|
y, x = stdscr.getyx()
|
||||||
if y == (row - 1):
|
if y == (row - 1):
|
||||||
stdscr.addstr(row - 1, 0, "<-Press Any Key->")
|
stdscr.addstr(row - 1, 0, "<-Press Any Key->")
|
||||||
stdscr.getch()
|
stdscr.getch()
|
||||||
stdscr.clear()
|
stdscr.clear()
|
||||||
stdscr.move(0, 0)
|
stdscr.move(0, 0)
|
||||||
if prev == '/' and ch == '*':
|
elif prev == '/' and ch == '*':
|
||||||
stdscr.attron(curses.A_BOLD)
|
stdscr.attron(curses.A_BOLD)
|
||||||
y, x = stdscr.getyx()
|
y, x = stdscr.getyx()
|
||||||
stdscr.addstr(y, x - 1, '/{0}'.format(ch))
|
stdscr.addstr(y, x - 1, '/{0}'.format(ch))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user