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>
11
<div class="example" style="border: solid 1px black; padding: 0.5em">
12
<label id="console_prompt">>>> </label>
13
<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 />
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>
29
<div id="console_body">
30
<div style="background-color: gray; border: 2px solid black; padding:
31
2px; color: black; font-family: monospace; font-weight: bold;">Python
34
<div style="overflow-y: scroll; margin: 0.5em">
36
<span style="color:#800">>>></span>
37
<span style="color:gray">i</span><br/>
38
<span style="color:red">name 'i' is not defined</span><br/>
39
<span style="color:#800">>>> </span>
40
<span style="color:gray">i=2</span><br/>
41
<span style="color:#800">>>> </span>
42
<span style="color:gray">print i</span><br/>
46
<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 />
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
67
<h2>When things go wrong...</h2>
68
<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 <emph>Interrupt</emph> 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 <emph>Console</emph> 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
2
<p>TODO: Write Console help</p>