blob: bd601b9ad2ea1815e48385cc65efe3a961d0cf1f [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
Fred Drake19479911998-02-13 06:58:54 +00005\setindexsubitem{(in module macconsole)}
Guido van Rossum86751151995-02-28 17:14:32 +00006
Jack Jansene4be9be1995-02-28 15:46:09 +00007This module is available on the Macintosh, provided Python has been
Fred Drakef90dbc91998-03-14 21:53:48 +00008built using the Think \C{} compiler. It provides an interface to the
Jack Jansene4be9be1995-02-28 15:46:09 +00009Think 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}
Fred Drakef90dbc91998-03-14 21:53:48 +000020Options for the \code{setmode} method. \constant{C_ECHO} and
21\constant{C_CBREAK} enable character echo, the other two disable it,
22\constant{C_ECHO} and \constant{C_NOECHO} enable line-oriented input
23(erase/kill processing, etc).
Jack Jansene4be9be1995-02-28 15:46:09 +000024\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
Fred Drake19479911998-02-13 06:58:54 +000039\setindexsubitem{(macconsole option)}
Jack Jansene4be9be1995-02-28 15:46:09 +000040\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
Fred Drake19479911998-02-13 06:58:54 +000066\setindexsubitem{(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
Fred Drakef90dbc91998-03-14 21:53:48 +000070buffered, you should call \code{\var{file}.flush()} between
71\code{write()} and \code{read()} calls.
Jack Jansene4be9be1995-02-28 15:46:09 +000072\end{datadesc}
73
Fred Drake19479911998-02-13 06:58:54 +000074\setindexsubitem{(console window method)}
Guido van Rossum470be141995-03-17 16:07:09 +000075
Jack Jansene4be9be1995-02-28 15:46:09 +000076\begin{funcdesc}{setmode}{mode}
Fred Drakef90dbc91998-03-14 21:53:48 +000077Set the input mode of the console to \constant{C_ECHO}, etc.
Jack Jansene4be9be1995-02-28 15:46:09 +000078\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}