tests/curses_get_wch.py
changeset 110 cf3d49cdd6e2
equal deleted inserted replaced
109:105b1affc3c2 110:cf3d49cdd6e2
       
     1 #!/usr/bin/python3
       
     2 
       
     3 import curses
       
     4 import locale
       
     5 
       
     6 locale.setlocale(locale.LC_ALL, "")
       
     7 
       
     8 def doStuff(stdscr):
       
     9   stdscr.keypad(1)
       
    10   message = "Press 'q' to quit.\n"
       
    11   stdscr.addstr(0, 0, message, 0)
       
    12   while True:
       
    13     c = stdscr.get_wch() # pauses until a key's hit
       
    14     if c == 'q':
       
    15       break
       
    16     stdscr.addstr('%s %r\n' % (c, c))
       
    17 
       
    18 curses.wrapper(doStuff)