2
1
<p>The IVLE <strong>Console</strong> is a programming console for Python which provides features similar to the Python command line console or <a href="http://en.wikipedia.org/wiki/IDLE_(Python)">IDLE</a> GUI.</p>
4
3
<h2>Getting started</h2>
5
4
<h3>Entering Python code</h3>
6
5
<p>Using the console is fairly straightforward. Enter any valid Python code into the input text box located just to the right of the prompt (<code>>>></code>) at the bottom of the screen. When the line is complete, press ENTER to execute the code.</p>
8
<div class="console_help_example">
9
<div class="console_heading">
10
Python Console (example)
12
<div class="console_help_example_body">
13
<div class="console_input" style="padding-top: 0.5em">
16
<label class="console_prompt">>>> </label>
18
<div class="console_inputCell">
19
<input type="text" value="print 'Hello, world!'" class="console_inputText" disabled="disabled" />
22
<input type="button" value="Interrupt" disabled="disabled" />
23
<input type="button" value="Clear Output" disabled="disabled" />
24
<input type="button" value="Reset" disabled="disabled" />
7
<div class="example" style="border: solid 1px black; padding: 0.5em">
8
<label id="console_prompt">>>> </label>
9
<input id="console_inputText"
10
type="text" size="80" value="print 'Hello, world!'" readonly="readonly" />
11
<input type='button' value='Interrupt' disabled="disabled" />
12
<input type='button' value='Clear Output' disabled="disabled" />
31
<p>Sometimes Python may expect additional lines of input — for example, after the <code>if</code> or <code>for</code> statements. This condition is indicated by a <code>...</code> prompt next to the input. Complete the command by entering additional lines as required. Press ENTER with an empty line to mark the code block as complete and execute it.</p>
15
<p>Sometimes Python may expect additional lines of input - for example, after the <code>if</code> or <code>for</code> statements. This condition is indicated by a <code>...</code> prompt next to the input. Complete the command by entering additional lines as required. Press ENTER with an empty line to mark the code block as complete and execute it.</p>
33
17
<p>Finally, some commands (such as <code>raw_input()</code>) may expect further input from the user. In this case the prompt will be replaced with <code>+++</code> to indicate that input other than Python code is required.</p>
35
<p>Please note that the console will time out after a period of inactivity. This has a similar result (and thus similar ramifications) to <a href="#restarting">restarting the console manually</a>. There is also a limit on the amount of CPU power a single console can use. This limit is in place to prevent accidental monopolisation of resources; if you exceed it, just <a href="#restarting">restart the console session</a>.</p>
19
<p>Please note that the console will time out after a period of inactivity. This has a similar result (and thus similar ramifications) to <a href="#restarting">restarting the console manually</a>.</p>
37
21
<h3>Interpreting output</h3>
38
<div class="console_help_example">
39
<div class="console_heading">
40
Python Console (example)
42
<div class="console_help_example_body">
43
<pre class="console_output outputMsg">
44
<span class="inputPrompt">>>> </span> <span class="inputMsg">i</span>
45
<span class="errorMsg">Traceback (most recent call last):
46
File "<web session>", line 1, in <module>
47
NameError: name 'i' is not defined</span>
48
<span class="inputPrompt">>>> </span><span class="inputMsg">i = 2</span>
49
<span class="inputPrompt">>>> </span><span class="inputMsg">if i == 2:</span>
50
<span class="inputPrompt">... </span><span class="inputMsg"> print i</span>
51
<span class="inputPrompt">... </span><span class="inputMsg"></span>
53
<div class="console_input">
56
<label class="console_prompt">>>> </label>
58
<div class="console_inputCell">
59
<input type="text" class="console_inputText" disabled="disabled" />
62
<input type="button" value="Interrupt" disabled="disabled" />
63
<input type="button" value="Clear Output" disabled="disabled" />
64
<input type="button" value="Reset" disabled="disabled" />
23
<div id="console_body">
24
<div style="background-color: gray; border: 2px solid black; padding:
25
2px; color: black; font-family: monospace; font-weight: bold;">Python
28
<div style="overflow-y: scroll; margin: 0.5em">
30
<span style="color:#800">>>></span>
31
<span style="color:gray">i</span><br/>
32
<span style="color:red">name 'i' is not defined</span><br/>
33
<span style="color:#800">>>> </span>
34
<span style="color:gray">i=2</span><br/>
35
<span style="color:#800">>>> </span>
36
<span style="color:gray">print i</span><br/>
40
<div id="console_inputArea">
41
<label id="console_prompt_2">>>> </label>
42
<input id="console_inputText_2" type="text" size="80" value="print i+2"
43
readonly="readonly" />
44
<input type='button' value='Interrupt' disabled="disabled" />
45
<input type='button' value='Clear Output' disabled="disabled" />
71
<p>Each line that you have entered — as well as any output produced — is shown in the text area above the input. Lines beginning with a normal prompt (<code style="color: #800">>>></code>) are your input lines, while lines in red (such as <code style="color: red">invalid syntax (<input>, line 1)</code>) are generated errors or exceptions. Other lines are normal output from your code.</p>
49
<p>Each line that you have entered - as well as any output produced - is shown in the text area above the input. Lines beginning with a normal prompt (<code style="color: #800">>>></code>) are your input lines, while lines in red (such as <code style="color: red">invalid syntax (<input>, line 1)</code>) are generated errors or exceptions. Other lines are normal output from your code.</p>
73
51
<h3>Reviewing history</h3>
74
52
<p>The IVLE console maintains a log of all entered commands in order to allow simple repetition of history. The up and down arrow keys will scroll backwards and forwards through the input history. As with any other line of code, pressing ENTER will execute the line currently in the input.</p>