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