next up previous contents index
Next: Text Output Up: Main Functions 2 Previous: Graphical Input   Contents   Index

Text Input

(scalar) AskReal(prompt, default)
The two arguments are both strings, or 0 (equivalent to the predefined constant NULL). The function will print the strings on the prompt line, and the user will type a response. The response is converted to a real number which is returned by the function. If either argument is null, that part of the message is not printed. The prompt is immutable, but the default can be edited by the user.
Example:
a = AskReal("enter a value for a ", "2.5")

(string) AskString(prompt, default)
The two arguments and the return value are strings. Similar to the AskReal function, however a string is returned.
Example:
title = AskString("Enter your title: ", "Senior Computer Geek")

(scalar) AskConsoleReal(prompt, default)
This function prompts the user for a number, in the console window. It is otherwise similar to the AskReal function.

(string) AskConsoleString(prompt, default)
This function prompts the user for a string, in the console window. It is otherwise similar to the AskString function.

(int) GetKey()
This function blocks until any key is pressed. The return value is a key code, which is system dependent, but is generally the ``keysym'' of the key pressed. If the value is less than 20, the value is an internal code.


next up previous contents index
Next: Text Output Up: Main Functions 2 Previous: Graphical Input   Contents   Index
Stephen R. Whiteley 2024-09-29