tests/curses_mouse.py
changeset 110 cf3d49cdd6e2
parent 20 472a753664f9
equal deleted inserted replaced
109:105b1affc3c2 110:cf3d49cdd6e2
     1 #!/usr/bin/python
     1 #!/usr/bin/python3
     2 # -*- coding: utf-8 -*-
       
     3 
     2 
     4 import curses
     3 import curses
     5 import locale
     4 import locale
     6 
     5 
     7 locale.setlocale(locale.LC_ALL,"")
     6 locale.setlocale(locale.LC_ALL,"")
    19         if c < 256:
    18         if c < 256:
    20             char = curses.unctrl(c)
    19             char = curses.unctrl(c)
    21         screen.addstr('key: %x %s\n' % (c, char))
    20         screen.addstr('key: %x %s\n' % (c, char))
    22 
    21 
    23         if c == curses.KEY_MOUSE:
    22         if c == curses.KEY_MOUSE:
    24             m = curses.getmouse()
    23             id_, x, y, z, bstate = curses.getmouse()
    25             screen.addstr('(%d %d %d %d %x)\n' % m)
    24             screen.addstr('(%d %d %d %d %s)\n' % (id_, x, y, z, bin(bstate)))
    26 
    25 
    27         screen.refresh()
    26         screen.refresh()
    28 
    27 
    29 curses.wrapper(doStuff)
    28 curses.wrapper(doStuff)