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