@@ -122,8 +122,9 @@ to call::
122122 stdscr.keypad(False)
123123 curses.echo()
124124
125- to reverse the curses-friendly terminal settings. Then call the :func: `endwin `
126- function to restore the terminal to its original operating mode. ::
125+ to reverse the curses-friendly terminal settings. Then call the
126+ :func: `~curses.endwin ` function to restore the terminal to its original
127+ operating mode. ::
127128
128129 curses.endwin()
129130
@@ -152,7 +153,7 @@ importing the :func:`curses.wrapper` function and using it like this::
152153
153154 wrapper(main)
154155
155- The :func: `wrapper ` function takes a callable object and does the
156+ The :func: `~curses. wrapper ` function takes a callable object and does the
156157initializations described above, also initializing colors if color
157158support is present. :func: `wrapper ` then runs your provided callable.
158159Once the callable returns, :func: `wrapper ` will restore the original
@@ -170,7 +171,7 @@ Windows are the basic abstraction in curses. A window object represents a
170171rectangular area of the screen, and supports methods to display text,
171172erase it, allow the user to input strings, and so forth.
172173
173- The ``stdscr `` object returned by the :func: `initscr ` function is a
174+ The ``stdscr `` object returned by the :func: `~curses. initscr ` function is a
174175window object that covers the entire screen. Many programs may need
175176only this single window, but you might wish to divide the screen into
176177smaller windows, in order to redraw or clear them separately. The
@@ -267,14 +268,14 @@ twisty maze of functions, all subtly different. For example,
267268:c:func: `addstr ` displays a string at the current cursor location in
268269the ``stdscr `` window, while :c:func: `mvaddstr ` moves to a given y,x
269270coordinate first before displaying the string. :c:func: `waddstr ` is just
270- like :func: `addstr `, but allows specifying a window to use instead of
271+ like :c: func: `addstr `, but allows specifying a window to use instead of
271272using ``stdscr `` by default. :c:func: `mvwaddstr ` allows specifying both
272273a window and a coordinate.
273274
274275Fortunately the Python interface hides all these details. ``stdscr ``
275- is a window object like any other, and methods such as :meth: ` addstr `
276- accept multiple argument forms. Usually there are four different
277- forms.
276+ is a window object like any other, and methods such as
277+ :meth: ` ~curses.window.addstr ` accept multiple argument forms. Usually there
278+ are four different forms.
278279
279280+---------------------------------+-----------------------------------------------+
280281| Form | Description |
@@ -325,7 +326,7 @@ apparently random location.
325326If your application doesn't need a blinking cursor at all, you can
326327call ``curs_set(False) `` to make it invisible. For compatibility
327328with older curses versions, there's a ``leaveok(bool) `` function
328- that's a synonym for :func: `curs_set `. When *bool * is true, the
329+ that's a synonym for :func: `~curses. curs_set `. When *bool * is true, the
329330curses library will attempt to suppress the flashing cursor, and you
330331won't need to worry about leaving it in odd locations.
331332
@@ -372,20 +373,22 @@ The curses library also supports color on those terminals that provide it. The
372373most common such terminal is probably the Linux console, followed by color
373374xterms.
374375
375- To use color, you must call the :func: `start_color ` function soon after calling
376- :func: `initscr `, to initialize the default color set (the
377- :func: `curses.wrapper ` function does this automatically). Once that's
378- done, the :func: `has_colors ` function returns TRUE if the terminal in use can
376+ To use color, you must call the :func: `~curses.start_color ` function soon
377+ after calling :func: `~curses.initscr `, to initialize the default color set
378+ (the :func: `curses.wrapper ` function does this automatically). Once that's
379+ done, the :func: `~curses.has_colors ` function returns TRUE if the terminal
380+ in use can
379381actually display color. (Note: curses uses the American spelling 'color',
380382instead of the Canadian/British spelling 'colour'. If you're used to the
381383British spelling, you'll have to resign yourself to misspelling it for the sake
382384of these functions.)
383385
384386The curses library maintains a finite number of color pairs, containing a
385387foreground (or text) color and a background color. You can get the attribute
386- value corresponding to a color pair with the :func: `color_pair ` function; this
387- can be bitwise-OR'ed with other attributes such as :const: `A_REVERSE `, but
388- again, such combinations are not guaranteed to work on all terminals.
388+ value corresponding to a color pair with the :func: `~curses.color_pair `
389+ function; this can be bitwise-OR'ed with other attributes such as
390+ :const: `A_REVERSE `, but again, such combinations are not guaranteed to work
391+ on all terminals.
389392
390393An example, which displays a line of text using color pair 1::
391394
@@ -418,9 +421,10 @@ Very fancy terminals can change the definitions of the actual colors to a given
418421RGB value. This lets you change color 1, which is usually red, to purple or
419422blue or any other color you like. Unfortunately, the Linux console doesn't
420423support this, so I'm unable to try it out, and can't provide any examples. You
421- can check if your terminal can do this by calling :func: `can_change_color `,
422- which returns True if the capability is there. If you're lucky enough to have
423- such a talented terminal, consult your system's man pages for more information.
424+ can check if your terminal can do this by calling
425+ :func: `~curses.can_change_color `, which returns True if the capability is
426+ there. If you're lucky enough to have such a talented terminal, consult your
427+ system's man pages for more information.
424428
425429
426430User Input
@@ -434,7 +438,7 @@ collections of widgets.)
434438There are two methods for getting input from a window:
435439
436440* :meth: `~curses.window.getch ` refreshes the screen and then waits for
437- the user to hit a key, displaying the key if :func: `echo ` has been
441+ the user to hit a key, displaying the key if :func: `~curses. echo ` has been
438442 called earlier. You can optionally specify a coordinate to which
439443 the cursor should be moved before pausing.
440444
0 commit comments