author | Radek Brich <radek.brich@devl.cz> |
Mon, 16 Feb 2015 21:17:43 +0100 | |
changeset 117 | 8680c2333546 |
parent 110 | cf3d49cdd6e2 |
permissions | -rwxr-xr-x |
110
cf3d49cdd6e2
Add cursesw driver, using curses get_wch() for unicode input. It alse has enabled keypad() to let curses interpret control keys and mouse input.
Radek Brich <radek.brich@devl.cz>
parents:
20
diff
changeset
|
1 |
#!/usr/bin/python3 |
20
472a753664f9
Update utf8 character input to Python3. Reorganize tests.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
2 |
|
472a753664f9
Update utf8 character input to Python3. Reorganize tests.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
3 |
import curses |
472a753664f9
Update utf8 character input to Python3. Reorganize tests.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
4 |
import locale |
472a753664f9
Update utf8 character input to Python3. Reorganize tests.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
5 |
|
472a753664f9
Update utf8 character input to Python3. Reorganize tests.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
6 |
locale.setlocale(locale.LC_ALL, "") |
472a753664f9
Update utf8 character input to Python3. Reorganize tests.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
7 |
|
472a753664f9
Update utf8 character input to Python3. Reorganize tests.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
8 |
def doStuff(stdscr): |
472a753664f9
Update utf8 character input to Python3. Reorganize tests.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
9 |
message = "Press 'q' to quit.\n" |
472a753664f9
Update utf8 character input to Python3. Reorganize tests.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
10 |
stdscr.addstr(0, 0, message, 0) |
472a753664f9
Update utf8 character input to Python3. Reorganize tests.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
11 |
while True: |
472a753664f9
Update utf8 character input to Python3. Reorganize tests.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
12 |
c = stdscr.getkey() # pauses until a key's hit |
472a753664f9
Update utf8 character input to Python3. Reorganize tests.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
13 |
if c == 'q': |
472a753664f9
Update utf8 character input to Python3. Reorganize tests.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
14 |
break |
472a753664f9
Update utf8 character input to Python3. Reorganize tests.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
15 |
stdscr.addstr('%s %r\n' % (c, c)) |
472a753664f9
Update utf8 character input to Python3. Reorganize tests.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
16 |
|
472a753664f9
Update utf8 character input to Python3. Reorganize tests.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
17 |
curses.wrapper(doStuff) |