Exemple #1
0
 def getch(self, *args):
     if len(args) == 0:
         val = lib.wgetch(self._win)
     elif len(args) == 2:
         val = lib.mvwgetch(self._win, *args)
     else:
         raise error("getch requires 0 or 2 arguments")
     return val
Exemple #2
0
 def getch(self, *args):
     if len(args) == 0:
         val = lib.wgetch(self._win)
     elif len(args) == 2:
         val = lib.mvwgetch(self._win, *args)
     else:
         raise error("getch requires 0 or 2 arguments")
     return val
Exemple #3
0
    def getkey(self, *args):
        if len(args) == 0:
            val = lib.wgetch(self._win)
        elif len(args) == 2:
            val = lib.mvwgetch(self._win, *args)
        else:
            raise error("getkey requires 0 or 2 arguments")

        if val == lib.ERR:
            raise error("no input")
        elif val <= 255:
            return chr(val)
        else:
            # XXX: The following line is different if `__NetBSD__` is defined.
            val = lib.keyname(val)
            if val == ffi.NULL:
                return ""
            return ffi.string(val)
Exemple #4
0
    def getkey(self, *args):
        if len(args) == 0:
            val = lib.wgetch(self._win)
        elif len(args) == 2:
            val = lib.mvwgetch(self._win, *args)
        else:
            raise error("getkey requires 0 or 2 arguments")

        if val == lib.ERR:
            raise error("no input")
        elif val <= 255:
            return chr(val)
        else:
            # XXX: The following line is different if `__NetBSD__` is defined.
            val = lib.keyname(val)
            if val == ffi.NULL:
                return ""
            return ffi.string(val)