Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
a7878b77
Commit
a7878b77
authored
Jul 14, 2011
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Close #6755: Add get_wch() method to curses.window class
Patch by Iñigo Serna.
parent
d33344a0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
0 deletions
+53
-0
Doc/library/curses.rst
Doc/library/curses.rst
+8
-0
Doc/whatsnew/3.3.rst
Doc/whatsnew/3.3.rst
+8
-0
Misc/ACKS
Misc/ACKS
+1
-0
Misc/NEWS
Misc/NEWS
+3
-0
Modules/_cursesmodule.c
Modules/_cursesmodule.c
+33
-0
No files found.
Doc/library/curses.rst
View file @
a7878b77
...
...
@@ -846,6 +846,14 @@ the following methods:
until a key is pressed.
.. method:: window.get_wch([y, x])
Get a wide character. Like :meth:`getch`, but the integer returned is the
Unicode code point for the key pressed, so it can be passed to :func:`chr`.
.. versionadded:: 3.3
.. method:: window.getkey([y, x])
Get a character, returning a string instead of an integer, as :meth:`getch`
...
...
Doc/whatsnew/3.3.rst
View file @
a7878b77
...
...
@@ -91,6 +91,14 @@ versions.
(:issue:`12100`)
curses
------
The :class:`curses.window` class has a new :class:`~curses.window.get_wch`
method to a wide character. Patch by Iñigo Serna.
(:issue:`6755`)
faulthandler
------------
...
...
Misc/ACKS
View file @
a7878b77
...
...
@@ -851,6 +851,7 @@ Nick Seidenman
Yury Selivanov
Fred Sells
Jiwon Seo
Iñigo Serna
Roger D. Serwy
Jerry Seutter
Denis Severson
...
...
Misc/NEWS
View file @
a7878b77
...
...
@@ -225,6 +225,9 @@ Core and Builtins
Library
-------
- Issue #6755: Add get_wch() method to curses.window class. Patch by Iñigo
Serna.
- Add cgi.closelog() function to close the log file.
- Issue #12502: asyncore: fix polling loop with AF_UNIX sockets.
...
...
Modules/_cursesmodule.c
View file @
a7878b77
...
...
@@ -906,6 +906,38 @@ PyCursesWindow_GetKey(PyCursesWindowObject *self, PyObject *args)
}
}
static
PyObject
*
PyCursesWindow_Get_WCh
(
PyCursesWindowObject
*
self
,
PyObject
*
args
)
{
int
x
,
y
;
int
ct
;
wint_t
rtn
;
switch
(
PyTuple_Size
(
args
))
{
case
0
:
Py_BEGIN_ALLOW_THREADS
ct
=
wget_wch
(
self
->
win
,
&
rtn
);
Py_END_ALLOW_THREADS
break
;
case
2
:
if
(
!
PyArg_ParseTuple
(
args
,
"ii;y,x"
,
&
y
,
&
x
))
return
NULL
;
Py_BEGIN_ALLOW_THREADS
ct
=
mvwget_wch
(
self
->
win
,
y
,
x
,
&
rtn
);
Py_END_ALLOW_THREADS
break
;
default:
PyErr_SetString
(
PyExc_TypeError
,
"get_wch requires 0 or 2 arguments"
);
return
NULL
;
}
if
(
ct
==
ERR
)
{
/* get_wch() returns ERR in nodelay mode */
PyErr_SetString
(
PyCursesError
,
"no input"
);
return
NULL
;
}
return
PyLong_FromLong
(
rtn
);
}
static
PyObject
*
PyCursesWindow_GetStr
(
PyCursesWindowObject
*
self
,
PyObject
*
args
)
{
...
...
@@ -1604,6 +1636,7 @@ static PyMethodDef PyCursesWindow_Methods[] = {
{
"getbkgd"
,
(
PyCFunction
)
PyCursesWindow_GetBkgd
,
METH_NOARGS
},
{
"getch"
,
(
PyCFunction
)
PyCursesWindow_GetCh
,
METH_VARARGS
},
{
"getkey"
,
(
PyCFunction
)
PyCursesWindow_GetKey
,
METH_VARARGS
},
{
"get_wch"
,
(
PyCFunction
)
PyCursesWindow_Get_WCh
,
METH_VARARGS
},
{
"getmaxyx"
,
(
PyCFunction
)
PyCursesWindow_getmaxyx
,
METH_NOARGS
},
{
"getparyx"
,
(
PyCFunction
)
PyCursesWindow_getparyx
,
METH_NOARGS
},
{
"getstr"
,
(
PyCFunction
)
PyCursesWindow_GetStr
,
METH_VARARGS
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment