When the selected Python script is a code-only script (like the example below), the right-hand panel of the Python Script Editor is used to enter and edit the code for that script.
The majority of your Python code will be standard Python 2.7x, but several specialized GainSeeker Python commands are also available.
Contents [Hide] |
To quickly find the list of GainSeeker Python commands, right-click the code window and then choose GainSeeker Python Commands.
For some GainSeeker Python commands, you can first use a simple Action interface to insert a block of basic code, and then modify that code as desired.
To do so, right-click the line of code where you wish to insert the basic code block, and then choose Add Action.
For information on choosing and customizing Actions, see Adding and Editing Actions.
Code Completion provides in-line assistance while you are entering a GainSeeker Python command.
While entering a GainSeeker Python
command, typing the period (.)
will trigger the display a list of the properties () and methods ()
associated with the command you have entered so far.
Characters typed after the period will narrow the list to items
that contain that character string:
Select a property or method by clicking or scrolling, and then
press TAB or ENTER to insert the selected item into your code.
While entering a GainSeeker Python
command, typing the left parenthesis (
will trigger the display of arguments needed. The arguments continue
to be displayed until you type the right parenthesis )
.
You can use toolbar buttons, the right-click menu, and more built-in tools to work with Python code.
You can use Ctrl+scrollwheel to change the size of the font in the code window.
Use the buttons on the toolbar to undo changes or to put them back (Redo).
To find a string, press Ctrl+F or right-click the code window and then choose Find. This will display a Find box in the code window.
Type the text you want to find. Any matching text will be highlighted. Use the arrow buttons or press F3 (or Shift+F3) to select the next (or previous) instance of the matching text.
Use the drop-down arrow for more specialized searches.
To automatically replace all instances of the text you specify with a new text string, press Ctrl+H or right-click the code window and then choose Replace. This will display a Replace window.
To comment the current line of code when no code is selected, press Ctrl+Shift+3. Or right-click the desired line of code and then choose Comment Line(s).
To comment all lines with code selected, select those lines and then press Ctrl+Shift+3. Or select those lines, right-click the code window and then choose Comment Line(s).
To move the current line of code when no code is selected, press Alt + Up Arrow or Alt + Down Arrow.
To move all lines with code selected, press Alt + Up Arrow or Alt + Down Arrow.
To delete the current line of code when no code is selected, press Ctrl+Shift+L.
To delete all lines with code selected, press Ctrl+Shift+L.
Some parts of the code are automatically colored as follows:
Red |
string values |
Orange |
numeric values |
Fuschia |
boolean values (True and False) |
Green |
Comments |
Blue |
Python keywords |
Brown |
None |
Navy |
import |
Teal |
try and except |
After you indent a line in a code block (such as if, while, for, etc.), pressing Enter to create new lines will automatically indent those lines as well.
You can save your script at any time by pressing Ctrl+S or by clicking the button on the toolbar. If you select another script or close the Python Script Editor before all changes have been saved, you will be prompted with the option to save changes.
To cancel unsaved changes, select another script or close the Python Script Editor and then click No when prompted.