def getstr(self, y, x, n=1023): n = min(n, 1023) buf = ffi.new("char[1024]") # /* This should be big enough.. I hope */ if y is None: val = lib.wgetnstr(self._win, buf, n) else: val = lib.mvwgetnstr(self._win, y, x, buf, n) if val == lib.ERR: return "" return ffi.string(buf)
def getstr(self, y, x, n=1023): n = min(n, 1023) if n < 0: raise ValueError("'n' must be nonnegative") buf = ffi.new("char[1024]") # /* This should be big enough.. I hope */ if y is None: val = lib.wgetnstr(self._win, buf, n) else: val = lib.mvwgetnstr(self._win, y, x, buf, n) if val == lib.ERR: return "" return ffi.string(buf)