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