Jack Jansen | e4be9be | 1995-02-28 15:46:09 +0000 | [diff] [blame] | 1 | \section{Built-in module \sectcode{macconsole}} |
| 2 | \bimodindex{macconsole} |
| 3 | |
Guido van Rossum | 8675115 | 1995-02-28 17:14:32 +0000 | [diff] [blame] | 4 | \renewcommand{\indexsubitem}{(in module macconsole)} |
| 5 | |
Jack Jansen | e4be9be | 1995-02-28 15:46:09 +0000 | [diff] [blame] | 6 | This module is available on the Macintosh, provided Python has been |
| 7 | built using the Think C compiler. It provides an interface to the |
| 8 | Think console package, with which basic text windows can be created. |
| 9 | |
| 10 | \begin{datadesc}{options} |
| 11 | An object allowing you to set various options when creating windows, |
| 12 | see below. |
| 13 | \end{datadesc} |
| 14 | |
| 15 | \begin{datadesc}{C_ECHO} |
| 16 | \dataline{C_NOECHO} |
| 17 | \dataline{C_CBREAK} |
| 18 | \dataline{C_RAW} |
| 19 | Options for the \code{setmode} method. \var{C_ECHO} and \var{C_CBREAK} |
| 20 | enable character echo, the other two disable it, \var{C_ECHO} and |
| 21 | \var{C_NOECHO} enable line-oriented input (erase/kill processing, |
| 22 | etc). |
| 23 | \end{datadesc} |
| 24 | |
| 25 | \begin{funcdesc}{copen}{} |
| 26 | Open a new console window. Returns a console window object. |
| 27 | \end{funcdesc} |
| 28 | |
| 29 | \begin{funcdesc}{fopen}{fp} |
| 30 | Return the console window object corresponding with the given file |
| 31 | object. \var{Fp} should be one of \var{sys.stdin}, \var{sys.stdout} or |
| 32 | \var{sys.stderr}. |
| 33 | \end{funcdesc} |
| 34 | |
| 35 | \subsection{macconsole options object} |
| 36 | These options are examined when a window is created: |
| 37 | |
| 38 | \renewcommand{\indexsubitem}{(macconsole option)} |
| 39 | \begin{datadesc}{top} |
| 40 | \dataline{left} |
| 41 | The origin of the window. |
| 42 | \end{datadesc} |
| 43 | |
| 44 | \begin{datadesc}{nrows} |
| 45 | \dataline{ncols} |
| 46 | The size of the window. |
| 47 | \end{datadesc} |
| 48 | |
| 49 | \begin{datadesc}{txFont} |
| 50 | \dataline{txSize} |
| 51 | \dataline{txStyle} |
| 52 | The font, fontsize and fontstyle to be used in the window. |
| 53 | \end{datadesc} |
| 54 | |
| 55 | \begin{datadesc}{title} |
| 56 | The title of the window. |
| 57 | \end{datadesc} |
| 58 | |
| 59 | \begin{datadesc}{pause_atexit} |
| 60 | If set non-zero, the window will wait for user action before closing |
| 61 | the window. |
| 62 | \end{datadesc} |
| 63 | |
| 64 | \subsection{console window object} |
| 65 | |
| 66 | \renewcommand{\indexsubitem}{(console window method)} |
| 67 | |
| 68 | \begin{datadesc}{file} |
| 69 | The file object corresponding to this console window. If the file is |
| 70 | buffered, you should call \code{file.flush()} between \code{write()} |
| 71 | and \code{read()} calls. |
| 72 | \end{datadesc} |
| 73 | |
| 74 | \begin{funcdesc}{setmode}{mode} |
| 75 | Set the input mode of the console to \var{C_ECHO}, etc. |
| 76 | \end{funcdesc} |
| 77 | |
| 78 | \begin{funcdesc}{settabs}{n} |
| 79 | Set the tabsize to \var{n} spaces. |
| 80 | \end{funcdesc} |
| 81 | |
| 82 | \begin{funcdesc}{cleos}{} |
| 83 | Clear to end-of-screen. |
| 84 | \end{funcdesc} |
| 85 | |
| 86 | \begin{funcdesc}{cleol}{} |
| 87 | Clear to end-of-line. |
| 88 | \end{funcdesc} |
| 89 | |
| 90 | \begin{funcdesc}{inverse}{onoff} |
| 91 | Enable inverse-video mode: characters with the high bit set are |
| 92 | displayed in inverse video (this disables the upper half of a |
| 93 | non-ascii character set). |
| 94 | \end{funcdesc} |
| 95 | |
| 96 | \begin{funcdesc}{gotoxy}{x\, y} |
| 97 | Set the cursor to position \code{(x, y)}. |
| 98 | \end{funcdesc} |
| 99 | |
| 100 | \begin{funcdesc}{hide}{} |
| 101 | Hide the window, remembering the contents. |
| 102 | \end{funcdesc} |
| 103 | |
| 104 | \begin{funcdesc}{show}{} |
| 105 | Show the window again. |
| 106 | \end{funcdesc} |
| 107 | |
| 108 | \begin{funcdesc}{echo2printer}{} |
| 109 | Copy everything written to the window to the printer as well. |
| 110 | \end{funcdesc} |