Contents:
Console
The main console window is shown below, this window contains consoles to control python interpreters (engines) along with toolbars and panes for other tools. Panes and toolbars can be rearranged, hidden or floated (via the view->toolbars and tools menus) and layouts can be stored/loaded using the view menu.Note: When closing the console window - it will in fact only be hidden (it can be reopened by double clicking on the taskbar icon, or selecting Console in the taskbar icon menu).This allows you to work in the editor or another integrated tool without having the console window open. To exit PTK use the menu option (File->Exit) in either the Editor or Console windows.
Using the console
To execute python code simply type the python commands at the prompt ('>>>') and press enter. The command will be executed and any output or errors will appear in the console. The line will also be automatically added to the command history. If enter is pressed when the cursor is not at the end of the line, a multiline command will be created (the prompt changes to '...'). The code will not be exectuted until enter is pressed with the cursor at the end of the line. To clear the current line press the [esc] key.Command history
To cycle through the command history use the [control]+[up] and [control]+[down] keys. If a partial command has been entered this will be used to search in the command history with only matching commands cycled through. Multiline commands are added to the command history as one entry allowing groups of commands to be exectuting repeatedlyAutocompletions
Object names - When typing '.' or pressing [ctrl]+[space] the autocompletion list will be opened, use the [up]+[down] keys to cycle through the options and [tab] or [enter] to select the desired entry or keep typing to search entries.Dictionary keys - when indexing a dictionary like object press [ctrl]+[space] will show string keys for the dictionary as well as object names that can be used a keys.
Filepaths - when entering a string pressing [ctrl]+[space] will display matching filepaths and directories/folder which can be browsed.
Calltips
When typing an opening round bracket [(] the calltip for object will be displayed. This can be resized, closed, or locked so that it remains open while you type using the icons in the corners. To re-open a function or other callables tip press [crtl]+[?] inside the call bracketsCommands
The console also supports several commands to control the PTK interface direcly from the prompt:Note: These commands are only available in PTK, so should not be relied upon for general code.
Command | Action |
---|---|
clear() | Clear the current console display |
ptk_help() | Display the help message in the console |
edit(filepath) | Open the filepath given in the editor. |
inspect(objectname) | Inspect the object with the name given in the inspector tool where objectname is a string/unicode object |
view(objectname) | Open a GUI view of the object with the name given if one is defined for the objects type. |