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