Last active
February 2, 2018 19:18
-
-
Save ashwinvis/fec85ef064eb3ead3f58d2c0d2c13371 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import curses | |
from random import randint | |
# Print random text in a 10x10 grid | |
stdscr = curses.initscr() | |
for rows in range(10): | |
line = ''.join([chr(randint(41, 90)) for i in range(10)]) | |
stdscr.addstr(line + '\n') | |
icol = 3 - 1 | |
irow = 6 - 1 | |
# Read | |
ch = stdscr.instr(irow, icol, 1).decode(encoding="utf-8") | |
# Show result | |
stdscr.move(irow, icol + 10) | |
stdscr.addstr('Character at column 3, row 6 = ' + ch + '\n') | |
stdscr.getch() | |
curses.endwin() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment