Fred Drake | 295da24 | 1998-08-10 19:42:37 +0000 | [diff] [blame] | 1 | \section{\module{fl} --- |
| 2 | FORMS library interface for GUI applications.} |
Fred Drake | b91e934 | 1998-07-23 17:59:49 +0000 | [diff] [blame] | 3 | \declaremodule{builtin}{fl} |
| 4 | |
| 5 | \modulesynopsis{FORMS library interface for GUI applications.} |
| 6 | |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 7 | |
Fred Drake | 5f874d6 | 1998-03-15 01:59:57 +0000 | [diff] [blame] | 8 | This module provides an interface to the FORMS Library\index{FORMS |
| 9 | Library} by Mark Overmars\index{Overmars, Mark}. The source for the |
| 10 | library can be retrieved by anonymous ftp from host |
| 11 | \samp{ftp.cs.ruu.nl}, directory \file{SGI/FORMS}. It was last tested |
| 12 | with version 2.0b. |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 13 | |
Fred Drake | 0cf0cfb | 1998-02-19 20:59:19 +0000 | [diff] [blame] | 14 | Most functions are literal translations of their \C{} equivalents, |
Guido van Rossum | 470be14 | 1995-03-17 16:07:09 +0000 | [diff] [blame] | 15 | dropping the initial \samp{fl_} from their name. Constants used by |
Fred Drake | 0cf0cfb | 1998-02-19 20:59:19 +0000 | [diff] [blame] | 16 | the library are defined in module \module{FL} described below. |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 17 | |
| 18 | The creation of objects is a little different in Python than in C: |
| 19 | instead of the `current form' maintained by the library to which new |
| 20 | FORMS objects are added, all functions that add a FORMS object to a |
Guido van Rossum | 470be14 | 1995-03-17 16:07:09 +0000 | [diff] [blame] | 21 | form are methods of the Python object representing the form. |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 22 | Consequently, there are no Python equivalents for the C functions |
Fred Drake | 0cf0cfb | 1998-02-19 20:59:19 +0000 | [diff] [blame] | 23 | \cfunction{fl_addto_form()} and \cfunction{fl_end_form()}, and the |
| 24 | equivalent of \cfunction{fl_bgn_form()} is called |
| 25 | \function{fl.make_form()}. |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 26 | |
| 27 | Watch out for the somewhat confusing terminology: FORMS uses the word |
| 28 | \dfn{object} for the buttons, sliders etc. that you can place in a form. |
| 29 | In Python, `object' means any value. The Python interface to FORMS |
| 30 | introduces two new Python object types: form objects (representing an |
| 31 | entire form) and FORMS objects (representing one button, slider etc.). |
Fred Drake | 0cf0cfb | 1998-02-19 20:59:19 +0000 | [diff] [blame] | 32 | Hopefully this isn't too confusing. |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 33 | |
| 34 | There are no `free objects' in the Python interface to FORMS, nor is |
| 35 | there an easy way to add object classes written in Python. The FORMS |
Guido van Rossum | 470be14 | 1995-03-17 16:07:09 +0000 | [diff] [blame] | 36 | interface to GL event handling is available, though, so you can mix |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 37 | FORMS with pure GL windows. |
| 38 | |
Fred Drake | 0cf0cfb | 1998-02-19 20:59:19 +0000 | [diff] [blame] | 39 | \strong{Please note:} importing \module{fl} implies a call to the GL |
| 40 | function \cfunction{foreground()} and to the FORMS routine |
| 41 | \cfunction{fl_init()}. |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 42 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 43 | \subsection{Functions Defined in Module \module{fl}} |
Guido van Rossum | 86cb092 | 1995-03-20 12:59:56 +0000 | [diff] [blame] | 44 | \nodename{FL Functions} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 45 | |
Fred Drake | 0cf0cfb | 1998-02-19 20:59:19 +0000 | [diff] [blame] | 46 | Module \module{fl} defines the following functions. For more |
| 47 | information about what they do, see the description of the equivalent |
| 48 | \C{} function in the FORMS documentation: |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 49 | |
Fred Drake | 5f874d6 | 1998-03-15 01:59:57 +0000 | [diff] [blame] | 50 | \begin{funcdesc}{make_form}{type, width, height} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 51 | Create a form with given type, width and height. This returns a |
| 52 | \dfn{form} object, whose methods are described below. |
| 53 | \end{funcdesc} |
| 54 | |
| 55 | \begin{funcdesc}{do_forms}{} |
| 56 | The standard FORMS main loop. Returns a Python object representing |
| 57 | the FORMS object needing interaction, or the special value |
Fred Drake | 0cf0cfb | 1998-02-19 20:59:19 +0000 | [diff] [blame] | 58 | \constant{FL.EVENT}. |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 59 | \end{funcdesc} |
| 60 | |
| 61 | \begin{funcdesc}{check_forms}{} |
Fred Drake | 0cf0cfb | 1998-02-19 20:59:19 +0000 | [diff] [blame] | 62 | Check for FORMS events. Returns what \function{do_forms()} above |
| 63 | returns, or \code{None} if there is no event that immediately needs |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 64 | interaction. |
| 65 | \end{funcdesc} |
| 66 | |
| 67 | \begin{funcdesc}{set_event_call_back}{function} |
| 68 | Set the event callback function. |
| 69 | \end{funcdesc} |
| 70 | |
Fred Drake | 5f874d6 | 1998-03-15 01:59:57 +0000 | [diff] [blame] | 71 | \begin{funcdesc}{set_graphics_mode}{rgbmode, doublebuffering} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 72 | Set the graphics modes. |
| 73 | \end{funcdesc} |
| 74 | |
| 75 | \begin{funcdesc}{get_rgbmode}{} |
Fred Drake | 5f874d6 | 1998-03-15 01:59:57 +0000 | [diff] [blame] | 76 | Return the current rgb mode. This is the value of the \C{} global |
Fred Drake | 0cf0cfb | 1998-02-19 20:59:19 +0000 | [diff] [blame] | 77 | variable \cdata{fl_rgbmode}. |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 78 | \end{funcdesc} |
| 79 | |
Fred Drake | 5f874d6 | 1998-03-15 01:59:57 +0000 | [diff] [blame] | 80 | \begin{funcdesc}{show_message}{str1, str2, str3} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 81 | Show a dialog box with a three-line message and an OK button. |
| 82 | \end{funcdesc} |
| 83 | |
Fred Drake | 5f874d6 | 1998-03-15 01:59:57 +0000 | [diff] [blame] | 84 | \begin{funcdesc}{show_question}{str1, str2, str3} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 85 | Show a dialog box with a three-line message and YES and NO buttons. |
| 86 | It returns \code{1} if the user pressed YES, \code{0} if NO. |
| 87 | \end{funcdesc} |
| 88 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 89 | \begin{funcdesc}{show_choice}{str1, str2, str3, but1\optional{, |
| 90 | but2\optional{, but3}}} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 91 | Show a dialog box with a three-line message and up to three buttons. |
| 92 | It returns the number of the button clicked by the user |
| 93 | (\code{1}, \code{2} or \code{3}). |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 94 | \end{funcdesc} |
| 95 | |
Fred Drake | 5f874d6 | 1998-03-15 01:59:57 +0000 | [diff] [blame] | 96 | \begin{funcdesc}{show_input}{prompt, default} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 97 | Show a dialog box with a one-line prompt message and text field in |
| 98 | which the user can enter a string. The second argument is the default |
| 99 | input string. It returns the string value as edited by the user. |
| 100 | \end{funcdesc} |
| 101 | |
Fred Drake | 5f874d6 | 1998-03-15 01:59:57 +0000 | [diff] [blame] | 102 | \begin{funcdesc}{show_file_selector}{message, directory, pattern, default} |
Guido van Rossum | 470be14 | 1995-03-17 16:07:09 +0000 | [diff] [blame] | 103 | Show a dialog box in which the user can select a file. It returns |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 104 | the absolute filename selected by the user, or \code{None} if the user |
| 105 | presses Cancel. |
| 106 | \end{funcdesc} |
| 107 | |
| 108 | \begin{funcdesc}{get_directory}{} |
| 109 | \funcline{get_pattern}{} |
| 110 | \funcline{get_filename}{} |
| 111 | These functions return the directory, pattern and filename (the tail |
Fred Drake | 0cf0cfb | 1998-02-19 20:59:19 +0000 | [diff] [blame] | 112 | part only) selected by the user in the last |
| 113 | \function{show_file_selector()} call. |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 114 | \end{funcdesc} |
| 115 | |
| 116 | \begin{funcdesc}{qdevice}{dev} |
| 117 | \funcline{unqdevice}{dev} |
| 118 | \funcline{isqueued}{dev} |
| 119 | \funcline{qtest}{} |
| 120 | \funcline{qread}{} |
| 121 | %\funcline{blkqread}{?} |
| 122 | \funcline{qreset}{} |
Fred Drake | 5f874d6 | 1998-03-15 01:59:57 +0000 | [diff] [blame] | 123 | \funcline{qenter}{dev, val} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 124 | \funcline{get_mouse}{} |
Fred Drake | 5f874d6 | 1998-03-15 01:59:57 +0000 | [diff] [blame] | 125 | \funcline{tie}{button, valuator1, valuator2} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 126 | These functions are the FORMS interfaces to the corresponding GL |
| 127 | functions. Use these if you want to handle some GL events yourself |
Fred Drake | 0cf0cfb | 1998-02-19 20:59:19 +0000 | [diff] [blame] | 128 | when using \function{fl.do_events()}. When a GL event is detected that |
| 129 | FORMS cannot handle, \function{fl.do_forms()} returns the special value |
| 130 | \constant{FL.EVENT} and you should call \function{fl.qread()} to read |
| 131 | the event from the queue. Don't use the equivalent GL functions! |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 132 | \end{funcdesc} |
| 133 | |
| 134 | \begin{funcdesc}{color}{} |
| 135 | \funcline{mapcolor}{} |
| 136 | \funcline{getmcolor}{} |
Fred Drake | 0cf0cfb | 1998-02-19 20:59:19 +0000 | [diff] [blame] | 137 | See the description in the FORMS documentation of |
| 138 | \cfunction{fl_color()}, \cfunction{fl_mapcolor()} and |
| 139 | \cfunction{fl_getmcolor()}. |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 140 | \end{funcdesc} |
| 141 | |
Guido van Rossum | 470be14 | 1995-03-17 16:07:09 +0000 | [diff] [blame] | 142 | \subsection{Form Objects} |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 143 | \label{form-objects} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 144 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 145 | Form objects (returned by \function{make_form()} above) have the |
Fred Drake | 0cf0cfb | 1998-02-19 20:59:19 +0000 | [diff] [blame] | 146 | following methods. Each method corresponds to a \C{} function whose |
| 147 | name is prefixed with \samp{fl_}; and whose first argument is a form |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 148 | pointer; please refer to the official FORMS documentation for |
| 149 | descriptions. |
| 150 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 151 | All the \method{add_*()} methods return a Python object representing |
| 152 | the FORMS object. Methods of FORMS objects are described below. Most |
| 153 | kinds of FORMS object also have some methods specific to that kind; |
| 154 | these methods are listed here. |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 155 | |
| 156 | \begin{flushleft} |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 157 | |
| 158 | \begin{methoddesc}[form]{show_form}{placement, bordertype, name} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 159 | Show the form. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 160 | \end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 161 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 162 | \begin{methoddesc}[form]{hide_form}{} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 163 | Hide the form. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 164 | \end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 165 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 166 | \begin{methoddesc}[form]{redraw_form}{} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 167 | Redraw the form. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 168 | \end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 169 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 170 | \begin{methoddesc}[form]{set_form_position}{x, y} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 171 | Set the form's position. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 172 | \end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 173 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 174 | \begin{methoddesc}[form]{freeze_form}{} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 175 | Freeze the form. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 176 | \end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 177 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 178 | \begin{methoddesc}[form]{unfreeze_form}{} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 179 | Unfreeze the form. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 180 | \end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 181 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 182 | \begin{methoddesc}[form]{activate_form}{} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 183 | Activate the form. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 184 | \end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 185 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 186 | \begin{methoddesc}[form]{deactivate_form}{} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 187 | Deactivate the form. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 188 | \end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 189 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 190 | \begin{methoddesc}[form]{bgn_group}{} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 191 | Begin a new group of objects; return a group object. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 192 | \end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 193 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 194 | \begin{methoddesc}[form]{end_group}{} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 195 | End the current group of objects. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 196 | \end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 197 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 198 | \begin{methoddesc}[form]{find_first}{} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 199 | Find the first object in the form. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 200 | \end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 201 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 202 | \begin{methoddesc}[form]{find_last}{} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 203 | Find the last object in the form. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 204 | \end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 205 | |
| 206 | %--- |
| 207 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 208 | \begin{methoddesc}[form]{add_box}{type, x, y, w, h, name} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 209 | Add a box object to the form. |
| 210 | No extra methods. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 211 | \end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 212 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 213 | \begin{methoddesc}[form]{add_text}{type, x, y, w, h, name} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 214 | Add a text object to the form. |
| 215 | No extra methods. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 216 | \end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 217 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 218 | %\begin{methoddesc}[form]{add_bitmap}{type, x, y, w, h, name} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 219 | %Add a bitmap object to the form. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 220 | %\end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 221 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 222 | \begin{methoddesc}[form]{add_clock}{type, x, y, w, h, name} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 223 | Add a clock object to the form. \\ |
| 224 | Method: |
Fred Drake | 0cf0cfb | 1998-02-19 20:59:19 +0000 | [diff] [blame] | 225 | \method{get_clock()}. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 226 | \end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 227 | |
| 228 | %--- |
| 229 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 230 | \begin{methoddesc}[form]{add_button}{type, x, y, w, h, name} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 231 | Add a button object to the form. \\ |
| 232 | Methods: |
Fred Drake | 0cf0cfb | 1998-02-19 20:59:19 +0000 | [diff] [blame] | 233 | \method{get_button()}, |
| 234 | \method{set_button()}. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 235 | \end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 236 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 237 | \begin{methoddesc}[form]{add_lightbutton}{type, x, y, w, h, name} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 238 | Add a lightbutton object to the form. \\ |
| 239 | Methods: |
Fred Drake | 0cf0cfb | 1998-02-19 20:59:19 +0000 | [diff] [blame] | 240 | \method{get_button()}, |
| 241 | \method{set_button()}. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 242 | \end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 243 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 244 | \begin{methoddesc}[form]{add_roundbutton}{type, x, y, w, h, name} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 245 | Add a roundbutton object to the form. \\ |
| 246 | Methods: |
Fred Drake | 0cf0cfb | 1998-02-19 20:59:19 +0000 | [diff] [blame] | 247 | \method{get_button()}, |
| 248 | \method{set_button()}. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 249 | \end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 250 | |
| 251 | %--- |
| 252 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 253 | \begin{methoddesc}[form]{add_slider}{type, x, y, w, h, name} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 254 | Add a slider object to the form. \\ |
| 255 | Methods: |
Fred Drake | 0cf0cfb | 1998-02-19 20:59:19 +0000 | [diff] [blame] | 256 | \method{set_slider_value()}, |
| 257 | \method{get_slider_value()}, |
| 258 | \method{set_slider_bounds()}, |
| 259 | \method{get_slider_bounds()}, |
| 260 | \method{set_slider_return()}, |
| 261 | \method{set_slider_size()}, |
| 262 | \method{set_slider_precision()}, |
| 263 | \method{set_slider_step()}. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 264 | \end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 265 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 266 | \begin{methoddesc}[form]{add_valslider}{type, x, y, w, h, name} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 267 | Add a valslider object to the form. \\ |
| 268 | Methods: |
Fred Drake | 0cf0cfb | 1998-02-19 20:59:19 +0000 | [diff] [blame] | 269 | \method{set_slider_value()}, |
| 270 | \method{get_slider_value()}, |
| 271 | \method{set_slider_bounds()}, |
| 272 | \method{get_slider_bounds()}, |
| 273 | \method{set_slider_return()}, |
| 274 | \method{set_slider_size()}, |
| 275 | \method{set_slider_precision()}, |
| 276 | \method{set_slider_step()}. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 277 | \end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 278 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 279 | \begin{methoddesc}[form]{add_dial}{type, x, y, w, h, name} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 280 | Add a dial object to the form. \\ |
| 281 | Methods: |
Fred Drake | 0cf0cfb | 1998-02-19 20:59:19 +0000 | [diff] [blame] | 282 | \method{set_dial_value()}, |
| 283 | \method{get_dial_value()}, |
| 284 | \method{set_dial_bounds()}, |
| 285 | \method{get_dial_bounds()}. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 286 | \end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 287 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 288 | \begin{methoddesc}[form]{add_positioner}{type, x, y, w, h, name} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 289 | Add a positioner object to the form. \\ |
| 290 | Methods: |
Fred Drake | 0cf0cfb | 1998-02-19 20:59:19 +0000 | [diff] [blame] | 291 | \method{set_positioner_xvalue()}, |
| 292 | \method{set_positioner_yvalue()}, |
| 293 | \method{set_positioner_xbounds()}, |
| 294 | \method{set_positioner_ybounds()}, |
| 295 | \method{get_positioner_xvalue()}, |
| 296 | \method{get_positioner_yvalue()}, |
| 297 | \method{get_positioner_xbounds()}, |
| 298 | \method{get_positioner_ybounds()}. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 299 | \end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 300 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 301 | \begin{methoddesc}[form]{add_counter}{type, x, y, w, h, name} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 302 | Add a counter object to the form. \\ |
| 303 | Methods: |
Fred Drake | 0cf0cfb | 1998-02-19 20:59:19 +0000 | [diff] [blame] | 304 | \method{set_counter_value()}, |
| 305 | \method{get_counter_value()}, |
| 306 | \method{set_counter_bounds()}, |
| 307 | \method{set_counter_step()}, |
| 308 | \method{set_counter_precision()}, |
| 309 | \method{set_counter_return()}. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 310 | \end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 311 | |
| 312 | %--- |
| 313 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 314 | \begin{methoddesc}[form]{add_input}{type, x, y, w, h, name} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 315 | Add a input object to the form. \\ |
| 316 | Methods: |
Fred Drake | 0cf0cfb | 1998-02-19 20:59:19 +0000 | [diff] [blame] | 317 | \method{set_input()}, |
| 318 | \method{get_input()}, |
| 319 | \method{set_input_color()}, |
| 320 | \method{set_input_return()}. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 321 | \end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 322 | |
| 323 | %--- |
| 324 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 325 | \begin{methoddesc}[form]{add_menu}{type, x, y, w, h, name} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 326 | Add a menu object to the form. \\ |
| 327 | Methods: |
Fred Drake | 0cf0cfb | 1998-02-19 20:59:19 +0000 | [diff] [blame] | 328 | \method{set_menu()}, |
| 329 | \method{get_menu()}, |
| 330 | \method{addto_menu()}. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 331 | \end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 332 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 333 | \begin{methoddesc}[form]{add_choice}{type, x, y, w, h, name} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 334 | Add a choice object to the form. \\ |
| 335 | Methods: |
Fred Drake | 0cf0cfb | 1998-02-19 20:59:19 +0000 | [diff] [blame] | 336 | \method{set_choice()}, |
| 337 | \method{get_choice()}, |
| 338 | \method{clear_choice()}, |
| 339 | \method{addto_choice()}, |
| 340 | \method{replace_choice()}, |
| 341 | \method{delete_choice()}, |
| 342 | \method{get_choice_text()}, |
| 343 | \method{set_choice_fontsize()}, |
| 344 | \method{set_choice_fontstyle()}. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 345 | \end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 346 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 347 | \begin{methoddesc}[form]{add_browser}{type, x, y, w, h, name} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 348 | Add a browser object to the form. \\ |
| 349 | Methods: |
Fred Drake | 0cf0cfb | 1998-02-19 20:59:19 +0000 | [diff] [blame] | 350 | \method{set_browser_topline()}, |
| 351 | \method{clear_browser()}, |
| 352 | \method{add_browser_line()}, |
| 353 | \method{addto_browser()}, |
| 354 | \method{insert_browser_line()}, |
| 355 | \method{delete_browser_line()}, |
| 356 | \method{replace_browser_line()}, |
| 357 | \method{get_browser_line()}, |
| 358 | \method{load_browser()}, |
| 359 | \method{get_browser_maxline()}, |
| 360 | \method{select_browser_line()}, |
| 361 | \method{deselect_browser_line()}, |
| 362 | \method{deselect_browser()}, |
| 363 | \method{isselected_browser_line()}, |
| 364 | \method{get_browser()}, |
| 365 | \method{set_browser_fontsize()}, |
| 366 | \method{set_browser_fontstyle()}, |
| 367 | \method{set_browser_specialkey()}. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 368 | \end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 369 | |
| 370 | %--- |
| 371 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 372 | \begin{methoddesc}[form]{add_timer}{type, x, y, w, h, name} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 373 | Add a timer object to the form. \\ |
| 374 | Methods: |
Fred Drake | 0cf0cfb | 1998-02-19 20:59:19 +0000 | [diff] [blame] | 375 | \method{set_timer()}, |
| 376 | \method{get_timer()}. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 377 | \end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 378 | \end{flushleft} |
| 379 | |
| 380 | Form objects have the following data attributes; see the FORMS |
| 381 | documentation: |
| 382 | |
Fred Drake | ee60191 | 1998-04-11 20:53:03 +0000 | [diff] [blame] | 383 | \begin{tableiii}{l|l|l}{member}{Name}{C Type}{Meaning} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 384 | \lineiii{window}{int (read-only)}{GL window id} |
| 385 | \lineiii{w}{float}{form width} |
| 386 | \lineiii{h}{float}{form height} |
| 387 | \lineiii{x}{float}{form x origin} |
| 388 | \lineiii{y}{float}{form y origin} |
| 389 | \lineiii{deactivated}{int}{nonzero if form is deactivated} |
| 390 | \lineiii{visible}{int}{nonzero if form is visible} |
| 391 | \lineiii{frozen}{int}{nonzero if form is frozen} |
| 392 | \lineiii{doublebuf}{int}{nonzero if double buffering on} |
| 393 | \end{tableiii} |
| 394 | |
Guido van Rossum | 470be14 | 1995-03-17 16:07:09 +0000 | [diff] [blame] | 395 | \subsection{FORMS Objects} |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 396 | \label{forms-objects} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 397 | |
| 398 | Besides methods specific to particular kinds of FORMS objects, all |
| 399 | FORMS objects also have the following methods: |
| 400 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 401 | \begin{methoddesc}[FORMS object]{set_call_back}{function, argument} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 402 | Set the object's callback function and argument. When the object |
| 403 | needs interaction, the callback function will be called with two |
| 404 | arguments: the object, and the callback argument. (FORMS objects |
Fred Drake | 0cf0cfb | 1998-02-19 20:59:19 +0000 | [diff] [blame] | 405 | without a callback function are returned by \function{fl.do_forms()} |
| 406 | or \function{fl.check_forms()} when they need interaction.) Call this |
| 407 | method without arguments to remove the callback function. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 408 | \end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 409 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 410 | \begin{methoddesc}[FORMS object]{delete_object}{} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 411 | Delete the object. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 412 | \end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 413 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 414 | \begin{methoddesc}[FORMS object]{show_object}{} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 415 | Show the object. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 416 | \end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 417 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 418 | \begin{methoddesc}[FORMS object]{hide_object}{} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 419 | Hide the object. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 420 | \end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 421 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 422 | \begin{methoddesc}[FORMS object]{redraw_object}{} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 423 | Redraw the object. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 424 | \end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 425 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 426 | \begin{methoddesc}[FORMS object]{freeze_object}{} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 427 | Freeze the object. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 428 | \end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 429 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 430 | \begin{methoddesc}[FORMS object]{unfreeze_object}{} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 431 | Unfreeze the object. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 432 | \end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 433 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 434 | %\begin{methoddesc}[FORMS object]{handle_object}{} XXX |
| 435 | %\end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 436 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 437 | %\begin{methoddesc}[FORMS object]{handle_object_direct}{} XXX |
| 438 | %\end{methoddesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 439 | |
| 440 | FORMS objects have these data attributes; see the FORMS documentation: |
| 441 | |
Fred Drake | ee60191 | 1998-04-11 20:53:03 +0000 | [diff] [blame] | 442 | \begin{tableiii}{l|l|l}{member}{Name}{C Type}{Meaning} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 443 | \lineiii{objclass}{int (read-only)}{object class} |
| 444 | \lineiii{type}{int (read-only)}{object type} |
| 445 | \lineiii{boxtype}{int}{box type} |
| 446 | \lineiii{x}{float}{x origin} |
| 447 | \lineiii{y}{float}{y origin} |
| 448 | \lineiii{w}{float}{width} |
| 449 | \lineiii{h}{float}{height} |
| 450 | \lineiii{col1}{int}{primary color} |
| 451 | \lineiii{col2}{int}{secondary color} |
| 452 | \lineiii{align}{int}{alignment} |
| 453 | \lineiii{lcol}{int}{label color} |
| 454 | \lineiii{lsize}{float}{label font size} |
| 455 | \lineiii{label}{string}{label string} |
| 456 | \lineiii{lstyle}{int}{label style} |
| 457 | \lineiii{pushed}{int (read-only)}{(see FORMS docs)} |
| 458 | \lineiii{focus}{int (read-only)}{(see FORMS docs)} |
| 459 | \lineiii{belowmouse}{int (read-only)}{(see FORMS docs)} |
| 460 | \lineiii{frozen}{int (read-only)}{(see FORMS docs)} |
| 461 | \lineiii{active}{int (read-only)}{(see FORMS docs)} |
| 462 | \lineiii{input}{int (read-only)}{(see FORMS docs)} |
| 463 | \lineiii{visible}{int (read-only)}{(see FORMS docs)} |
| 464 | \lineiii{radio}{int (read-only)}{(see FORMS docs)} |
| 465 | \lineiii{automatic}{int (read-only)}{(see FORMS docs)} |
| 466 | \end{tableiii} |
| 467 | |
Fred Drake | 295da24 | 1998-08-10 19:42:37 +0000 | [diff] [blame] | 468 | \section{\module{FL} --- |
| 469 | Constants used with the \module{fl} module.} |
Fred Drake | b91e934 | 1998-07-23 17:59:49 +0000 | [diff] [blame] | 470 | \declaremodule{standard}{FL} |
| 471 | |
| 472 | \modulesynopsis{Constants used with the \module{fl} module.} |
| 473 | |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 474 | |
| 475 | This module defines symbolic constants needed to use the built-in |
Fred Drake | 0cf0cfb | 1998-02-19 20:59:19 +0000 | [diff] [blame] | 476 | module \module{fl} (see above); they are equivalent to those defined in |
| 477 | the \C{} header file \code{<forms.h>} except that the name prefix |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 478 | \samp{FL_} is omitted. Read the module source for a complete list of |
| 479 | the defined names. Suggested use: |
| 480 | |
Fred Drake | 1947991 | 1998-02-13 06:58:54 +0000 | [diff] [blame] | 481 | \begin{verbatim} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 482 | import fl |
| 483 | from FL import * |
Fred Drake | 1947991 | 1998-02-13 06:58:54 +0000 | [diff] [blame] | 484 | \end{verbatim} |
Fred Drake | 0cf0cfb | 1998-02-19 20:59:19 +0000 | [diff] [blame] | 485 | |
Fred Drake | 295da24 | 1998-08-10 19:42:37 +0000 | [diff] [blame] | 486 | \section{\module{flp} --- |
| 487 | Loading functions for stored FORMS designs.} |
Fred Drake | b91e934 | 1998-07-23 17:59:49 +0000 | [diff] [blame] | 488 | \declaremodule{standard}{flp} |
| 489 | |
| 490 | \modulesynopsis{Loading functions for stored FORMS designs.} |
| 491 | |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 492 | |
| 493 | This module defines functions that can read form definitions created |
Fred Drake | 0cf0cfb | 1998-02-19 20:59:19 +0000 | [diff] [blame] | 494 | by the `form designer' (\program{fdesign}) program that comes with the |
| 495 | FORMS library (see module \module{fl} above). |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 496 | |
| 497 | For now, see the file \file{flp.doc} in the Python library source |
| 498 | directory for a description. |
| 499 | |
| 500 | XXX A complete description should be inserted here! |