blob: ad7e4f5b18ddf0c0ca6e1a08060140fe7dbc7a59 [file] [log] [blame]
Fred Drake3a0351c1998-04-04 07:23:21 +00001\section{Built-in Module \module{macconsole}}
Fred Drakefe7f3bc1998-07-23 17:55:31 +00002\declaremodule{builtin}{macconsole}
3
4\modulesynopsis{Think C's console package is available using this module.}
5
Jack Jansene4be9be1995-02-28 15:46:09 +00006
Guido van Rossum86751151995-02-28 17:14:32 +00007
Jack Jansene4be9be1995-02-28 15:46:09 +00008This module is available on the Macintosh, provided Python has been
Fred Drakef90dbc91998-03-14 21:53:48 +00009built using the Think \C{} compiler. It provides an interface to the
Jack Jansene4be9be1995-02-28 15:46:09 +000010Think console package, with which basic text windows can be created.
11
12\begin{datadesc}{options}
13An object allowing you to set various options when creating windows,
14see below.
15\end{datadesc}
16
17\begin{datadesc}{C_ECHO}
18\dataline{C_NOECHO}
19\dataline{C_CBREAK}
20\dataline{C_RAW}
Fred Drakef90dbc91998-03-14 21:53:48 +000021Options for the \code{setmode} method. \constant{C_ECHO} and
22\constant{C_CBREAK} enable character echo, the other two disable it,
23\constant{C_ECHO} and \constant{C_NOECHO} enable line-oriented input
24(erase/kill processing, etc).
Jack Jansene4be9be1995-02-28 15:46:09 +000025\end{datadesc}
26
27\begin{funcdesc}{copen}{}
Guido van Rossum6bb1adc1995-03-13 10:03:32 +000028Open a new console window. Return a console window object.
Jack Jansene4be9be1995-02-28 15:46:09 +000029\end{funcdesc}
30
31\begin{funcdesc}{fopen}{fp}
32Return the console window object corresponding with the given file
Guido van Rossum6bb1adc1995-03-13 10:03:32 +000033object. \var{fp} should be one of \code{sys.stdin}, \code{sys.stdout} or
34\code{sys.stderr}.
Jack Jansene4be9be1995-02-28 15:46:09 +000035\end{funcdesc}
36
37\subsection{macconsole options object}
38These options are examined when a window is created:
39
Fred Drake19479911998-02-13 06:58:54 +000040\setindexsubitem{(macconsole option)}
Jack Jansene4be9be1995-02-28 15:46:09 +000041\begin{datadesc}{top}
42\dataline{left}
43The origin of the window.
44\end{datadesc}
45
46\begin{datadesc}{nrows}
47\dataline{ncols}
48The size of the window.
49\end{datadesc}
50
51\begin{datadesc}{txFont}
52\dataline{txSize}
53\dataline{txStyle}
54The font, fontsize and fontstyle to be used in the window.
55\end{datadesc}
56
57\begin{datadesc}{title}
58The title of the window.
59\end{datadesc}
60
61\begin{datadesc}{pause_atexit}
Guido van Rossum6bb1adc1995-03-13 10:03:32 +000062If set non-zero, the window will wait for user action before closing.
Jack Jansene4be9be1995-02-28 15:46:09 +000063\end{datadesc}
64
65\subsection{console window object}
66
Fred Drake19479911998-02-13 06:58:54 +000067\setindexsubitem{(console window attribute)}
Jack Jansene4be9be1995-02-28 15:46:09 +000068
69\begin{datadesc}{file}
70The file object corresponding to this console window. If the file is
Fred Drakef90dbc91998-03-14 21:53:48 +000071buffered, you should call \code{\var{file}.flush()} between
72\code{write()} and \code{read()} calls.
Jack Jansene4be9be1995-02-28 15:46:09 +000073\end{datadesc}
74
Fred Drake19479911998-02-13 06:58:54 +000075\setindexsubitem{(console window method)}
Guido van Rossum470be141995-03-17 16:07:09 +000076
Jack Jansene4be9be1995-02-28 15:46:09 +000077\begin{funcdesc}{setmode}{mode}
Fred Drakef90dbc91998-03-14 21:53:48 +000078Set the input mode of the console to \constant{C_ECHO}, etc.
Jack Jansene4be9be1995-02-28 15:46:09 +000079\end{funcdesc}
80
81\begin{funcdesc}{settabs}{n}
82Set the tabsize to \var{n} spaces.
83\end{funcdesc}
84
85\begin{funcdesc}{cleos}{}
86Clear to end-of-screen.
87\end{funcdesc}
88
89\begin{funcdesc}{cleol}{}
90Clear to end-of-line.
91\end{funcdesc}
92
93\begin{funcdesc}{inverse}{onoff}
Guido van Rossum6bb1adc1995-03-13 10:03:32 +000094Enable inverse-video mode:\ characters with the high bit set are
Jack Jansene4be9be1995-02-28 15:46:09 +000095displayed in inverse video (this disables the upper half of a
Guido van Rossum6bb1adc1995-03-13 10:03:32 +000096non-\ASCII{} character set).
Jack Jansene4be9be1995-02-28 15:46:09 +000097\end{funcdesc}
98
Fred Drakecce10901998-03-17 06:33:25 +000099\begin{funcdesc}{gotoxy}{x, y}
Guido van Rossum6bb1adc1995-03-13 10:03:32 +0000100Set the cursor to position \code{(\var{x}, \var{y})}.
Jack Jansene4be9be1995-02-28 15:46:09 +0000101\end{funcdesc}
102
103\begin{funcdesc}{hide}{}
104Hide the window, remembering the contents.
105\end{funcdesc}
106
107\begin{funcdesc}{show}{}
108Show the window again.
109\end{funcdesc}
110
111\begin{funcdesc}{echo2printer}{}
112Copy everything written to the window to the printer as well.
113\end{funcdesc}