blob: 0be429b25fe2721ca5507402e3c285b4ebc5a482 [file] [log] [blame]
Jack Jansene4be9be1995-02-28 15:46:09 +00001\section{Built-in module \sectcode{macconsole}}
2\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}{}
26Open a new console window. Returns a console window object.
27\end{funcdesc}
28
29\begin{funcdesc}{fopen}{fp}
30Return the console window object corresponding with the given file
31object. \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}
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}
60If set non-zero, the window will wait for user action before closing
61the window.
62\end{datadesc}
63
64\subsection{console window object}
65
66\renewcommand{\indexsubitem}{(console window method)}
67
68\begin{datadesc}{file}
69The file object corresponding to this console window. If the file is
70buffered, you should call \code{file.flush()} between \code{write()}
71and \code{read()} calls.
72\end{datadesc}
73
74\begin{funcdesc}{setmode}{mode}
75Set the input mode of the console to \var{C_ECHO}, etc.
76\end{funcdesc}
77
78\begin{funcdesc}{settabs}{n}
79Set the tabsize to \var{n} spaces.
80\end{funcdesc}
81
82\begin{funcdesc}{cleos}{}
83Clear to end-of-screen.
84\end{funcdesc}
85
86\begin{funcdesc}{cleol}{}
87Clear to end-of-line.
88\end{funcdesc}
89
90\begin{funcdesc}{inverse}{onoff}
91Enable inverse-video mode: characters with the high bit set are
92displayed in inverse video (this disables the upper half of a
93non-ascii character set).
94\end{funcdesc}
95
96\begin{funcdesc}{gotoxy}{x\, y}
97Set the cursor to position \code{(x, y)}.
98\end{funcdesc}
99
100\begin{funcdesc}{hide}{}
101Hide the window, remembering the contents.
102\end{funcdesc}
103
104\begin{funcdesc}{show}{}
105Show the window again.
106\end{funcdesc}
107
108\begin{funcdesc}{echo2printer}{}
109Copy everything written to the window to the printer as well.
110\end{funcdesc}