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