The console module provides functions to control the text output area and keyboard input in Pythonista.
There are also several functions for presenting simple modal dialogs, and to access system services like the “Open in...” menu and QuickLook.
Clears the console output
Sets the font and font size for following output. Call with no parameters to reset to default.
Sets the RGB color for following output. The components are floats between 0.0 and 1.0.
This function is similar to the built-in raw_input function, but the user’s input is hidden, so that it’s suitable to request passwords and other sensitive information.
Show an image, loaded from a file, in the console output area.
Show an alert dialog with up to three custom buttons. The selected button is returned as an integer (button1 => 1 ...). Unless hide_cancel_button is True, all alert dialogs contain a ‘Cancel’ button that sends a KeyboardInterrupt.
Show a dialog with a single text field. The text field can be pre-filled with the input parameter. The text that was entered by the user is returned. The ‘Cancel’ button sends a KeyboardInterrupt.
Show a dialog with a password entry text field. The password field can be pre-filled with the password parameter. The password that was entered by the user is returned. The ‘Cancel’ button sends a KeyboardInterrupt (which will usually stop the script).
Show a dialog with two text fields, one for a login, one for a password. The text fields can be pre-filled with the login and password parameters. Returns a tuple of the entered text as (login, password). The ‘Cancel’ button sends a KeyboardInterrupt (which will usually stop the script).
Show the animated “network activity indicator” in the status bar.
The spinner is automatically hidden when a script ends. Calling this function when the spinner is already visible has no effect.
Hide the animated “network activity indicator” in the status bar.
The spinner is automatically hidden when a script ends. Calling this function when the spinner is not visible has no effect.
Show a HUD-style alert with the given message. The icon can be either 'success' (the default, a checkmark symbol), or 'error' (a cross symbol).
The duration parameter determines how long the alert is shown on screen. It can be between 0.25 and 5.0 seconds. The default is 1.8 seconds. The function blocks until the alert is dismissed.
Print a tappable link to the console with the given title and URL. Depending on the URL, it is either opened in the built-in browser (for http, https and file URLs), or opened in a different app (if possible).
If a custom text color is set via set_color(), the color of the link text is the same as that, otherwise, a default link color is used.
Hide the console output area with a sliding animation.
Show a full-screen preview of the local file(s) at the given path. It is possible to pass a sequence of paths (e.g. a list), in order to preview multiple files at once. The function returns when the preview is dismissed.
Many common file formats are supported:
Show the iOS “Open in...” menu for the specified file.
If an application was selected in the menu, its bundle identifier will be returned (for example 'com.getdropbox.Dropbox'). If the menu was cancelled, or no application is installed that can open the file, the return value is None.
Disable or enable the idle timer (which puts the device to sleep after a certain period of inactivity).