Console panel
Panel is called by key Ctrl+tilde (Ctrl+`). It has read-only memo with output and edit field. You can type Python commands in the edit field, they will run and show output in the memo. E.g. enter "print(10+12)" and you'll see output "22". Can enter complex commands: e.g. "for i in range(10): print(i)".
- If you enter command beginning with "=", then it's the same as you enterted "print()". E.g. command "=10+12" will give "22".
- If you end command with ";", it won't add to dropdown history.
- Double-click on memo lines starting with ">>>" repeats entered command (which is after ">>>").
Can enter commands from CudaText API. Example clears all bookmarks and sets bookmark on line 11 (these are several commands, run one by one):
- ed.bookmark(BOOKMARK_CLEAR_ALL, 0)
- ed.bookmark(BOOKMARK_SET, 10)
How to use Console as calculator
Call Console panel with Ctrl+` (Ctrl+tilde). In its input field, enter valid Python expressions with leading "=" char. To use "sin", "cos", "pi" etc, first enter command "from math import *".
Example of 3 entered lines and their log in console:
- >>> from math import *
- >>> =pi
- 3.141592653589793
- >>> =100/5+2
- 22.0