1
<p>The IVLE <strong>console</strong> is a programming console for python which
2
provides features similar to the built in python command line console or <a
3
href="http://en.wikipedia.org/wiki/IDLE_(Python)">IDLE GUI</a>.<p>
5
<h2>Getting Started with Console</h2>
6
<h3>Entering python code</h3>
7
<p>Using the console is fairly straight forward. Simply enter in any valid
8
python code into the input text box located just to the right of the
9
<code>>>></code> marks at the bottom of the screen. Once finished
10
simply press ENTER to execute that line.</p>
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>
3
<h2>Getting started</h2>
4
<h3>Entering Python code</h3>
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>
11
7
<div class="example" style="border: solid 1px black; padding: 0.5em">
12
8
<label id="console_prompt">>>> </label>
13
9
<input id="console_inputText"
14
type="text" size="80" value="print 'Hello, world!'" readonly />
15
<input type='button' value='Interrupt' disabled />
16
<input type='button' value='Clear Output' disabled />
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" />
18
<p>Sometimes statements may expect more than 1 line, for example after an
19
<code>if</code> or <code>for</code> statements. This is indicated by
20
<code>...</code> to the left of the input box. Complete the command by typing
21
in any additional lines and then press ENTER with an empty line to execute the
23
<p>Finally, some commands may expect input from the user (such as
24
<code>raw_input() function</code>). In this case <code>+++</code> will be shown
25
next to to the input text box to indicate that the console is expecting some
26
input from the user.</p>
27
<h3>Console output</h3>
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>
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>
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>
21
<h3>Interpreting output</h3>
28
22
<div class="example">
29
23
<div id="console_body">
30
24
<div style="background-color: gray; border: 2px solid black; padding:
41
35
<span style="color:#800">>>> </span>
42
36
<span style="color:gray">print i</span><br/>
46
40
<div id="console_inputArea">
47
<label id="console_prompt">>>> </label>
48
<input id="console_inputText" type="text" size="80" value="print i+2"
50
<input type='button' value='Interrupt' disabled />
51
<input type='button' value='Clear Output' disabled />
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" />
55
<p>All the commands you have entered as well as their output are shown in the
56
text area above the input box. Lines beginning with a <code style="color:
57
#800">>>></code> are your input lines, while lines in read (such as
58
<code style="color: red">invalid syntax (<input>, line 1)
59
</code>) are errors or exceptions generated by your code.</p>
60
<h3>Console history</h3>
61
<p>You can also see all the lines you have previously entered into the console
62
this session by pressing the UP arrow while in the text box. Pressing the DOWN
63
arrow will show you more recent line histories or bring you back to your
64
current line. You can even re-execute a line just by pressing the ENTER
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>
51
<h3>Reviewing history</h3>
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>
67
54
<h2>When things go wrong...</h2>
68
55
<h3>Interrupting commands</h3>
69
<p>It is possible to enter commands that will make the console become unusable
70
or spend a long time attempting to run your command. (For example, infinite
71
loops like <code>while True: print "Hello, world!"</code>). You can stop
72
execution of a loop by clicking on the <strong>Interrupt</strong> button which will
73
allow you to enter commands again.</p>
74
<h3>Restarting the console</h3>
75
<p>If things go really wrong, you can restart the console simply by clicking
76
the <strong>Console</strong> button to start a new console. Be aware that you will
77
loose all the variables and functions you had entered in to your previous
56
<p>It is possible to enter commands that will render the console unusable or take a long time to complete (infinite loops like <code>while True: print "Hello, world!"</code>, for example). You may terminate execution of the current command with the <em>Interrupt</em> button. This should allow you to resume entering of commands.</p>
58
<h3><a name="restarting">Restarting the console</a></h3>
59
<p>If things go really wrong, you can restart the console simply by clicking the <em>Console</em> tab. Be aware that you will lose all state (such as variables and functions) entered into your previous console session.</p>