Skip to content

Commit fd1d783

Browse files
author
Philip Guo
committed
bammmm
1 parent 56d8330 commit fd1d783

4 files changed

Lines changed: 173 additions & 91 deletions

File tree

‎v3/css/index.css‎

Lines changed: 59 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ body {
77
font-family: Georgia, Palatino, Times, serif;
88

99
font-size: 12pt;
10-
max-width: 900px;
10+
max-width: 1000px;
1111
margin-left: auto;
1212
margin-right: auto;
1313
}
@@ -23,20 +23,29 @@ h1 {
2323
}
2424

2525
h2 {
26-
font-size: 12pt;
26+
font-size: 14pt;
2727
font-weight: normal;
2828

2929
margin-top: 2px;
30-
margin-bottom: 20px;
30+
margin-bottom: 0px;
31+
}
32+
33+
.smallH1 {
34+
font-size: 14pt;
3135
}
3236

37+
3338
.titlePane {
3439
margin-left: auto;
3540
margin-right: auto;
36-
margin-bottom: 25px;
41+
margin-bottom: 20px;
3742
text-align: center;
3843
}
3944

45+
.titlePane h1 {
46+
font-size: 24pt;
47+
}
48+
4049
.titlePane h2 {
4150
margin-top: 8px;
4251
}
@@ -49,12 +58,17 @@ div.mainBodyPane {
4958

5059
div.activityPane {
5160
/* TOP RIGHT BOTTOM LEFT */
52-
padding: 15px 20px 5px 20px;
53-
margin-top: 30px;
61+
padding: 15px 25px 5px 20px;
5462
text-align: left;
5563
border: 3px solid #005583;
5664
}
5765

66+
div.activityPane h1 {
67+
font-size: 22pt;
68+
margin-bottom: 20pt;
69+
}
70+
71+
5872

5973
ul {
6074
padding-left: 18px;
@@ -71,12 +85,49 @@ a:hover {
7185
color: #3D58A2;
7286
}
7387

88+
div#learnPane {
89+
margin-bottom: 10pt;
90+
}
91+
92+
div#learnPane p {
93+
padding-right: 80px;
94+
}
95+
96+
div#learnPane h3 {
97+
font-size: 16pt;
98+
font-weight: normal;
99+
margin-top: 3px;
100+
margin-bottom: 8px;
101+
}
102+
103+
div#embedPane {
104+
margin-right: 5px;
105+
}
106+
107+
div#sharePane {
108+
margin-left: 5px;
109+
}
110+
111+
div#detailsPane {
112+
margin-top: 15px;
113+
margin-left: 5px;
114+
}
115+
116+
table#embedShareTable {
117+
border: 0px;
118+
width: 100%;
119+
}
120+
121+
table#embedShareTable td {
122+
vertical-align: top;
123+
}
124+
74125
#footer {
75126
color: #666666;
76127
font-size: 9pt;
77-
border-top: 1px solid #bbbbbb;
128+
/*border-top: 1px solid #bbbbbb;*/
78129
padding-top: 5px;
79-
margin-top: 15px;
130+
margin-top: 10px;
80131

81132
max-width: 100%;
82133
/* center align */

‎v3/index.html‎

Lines changed: 109 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -29,35 +29,9 @@
2929
3030
-->
3131

32-
<!--
33-
34-
myList = (1, (2, (3, None)))
35-
36-
def sumList(n, sub):
37-
if not n:
38-
return sub
39-
else:
40-
return sumList(n[1], sub + n[0])
41-
42-
total = sumList(myList, 0)
43-
44-
---
45-
46-
myList = (1, (2, (3, None)))
47-
48-
def sumList(n):
49-
if not n:
50-
return 0
51-
else:
52-
return n[0] + sumList(n[1])
53-
54-
total = sumList(myList)
55-
56-
-->
57-
5832
<head>
5933

60-
<title>Online Python Tutor: Learn and practice Python programming in your web browser</title>
34+
<title>Online Python Tutor: Visually learn Python programming</title>
6135

6236

6337
<!-- requirements for pytutor.js -->
@@ -84,106 +58,159 @@
8458
<div class="titlePane">
8559

8660
<h1>Online Python Tutor</h1>
87-
<h2>Learn and practice Python programming in your web browser</h2>
61+
<h2>Visually learn Python programming</h2>
8862

8963
</div>
9064

65+
9166
<div class="mainBodyPane">
9267

68+
<table id='embedShareTable'>
69+
<tr>
70+
<td colspan="2">
71+
9372
<div class="activityPane" id="learnPane">
9473

95-
<h1>Learn</h1>
96-
<h2>Python by writing code and visualizing execution</h2>
74+
<h1>Learn <span class="smallH1">to program in Python by writing code and visualizing execution</span></h1>
75+
76+
<p>Online Python Tutor allows teachers and students to write <a href="http://www.python.org/">Python</a>
77+
programs directly in the web browser, execute those programs, step
78+
<b>forwards and backwards</b> through execution to view the run-time
79+
state of data structures, and share their visualizations on the web.</p>
9780

98-
<p>This free educational application allows teachers and students to
99-
write Python scripts directly in the web browser, execute those scripts,
100-
single-step <b>forwards and backwards</b> through execution, and view
101-
the run-time state of all data structures.</p>
81+
<p>Rather than simply displaying a text-based console, Online Python
82+
Tutor visualizes stack frames, variables, and heap objects. For example,
83+
here is a recursive function that sums linked list elements:</p>
10284

103-
<p>Rather than displaying a bland text-based console, the Online Python
104-
Tutor provides a rich visualization of variables, heap objects, and
105-
stack frames. For example, the following code:</p>
85+
<div id="demoViz"></div>
10686

87+
<p>Since its inception in January 2010, over 100,000 people have used
88+
Online Python Tutor to understand and debug their programs. In addition,
89+
instructors in over a dozen universities including MIT, UC Berkeley, UC
90+
Davis, Sonoma State University, the University of Washington, the
91+
University of Waterloo, the University of Toronto, Luther College, and
92+
Swarthmore College have adopted it for teaching introductory computer
93+
science courses.</p>
10794

108-
<div id="demoViz"/>
95+
</p>
10996

110-
<h3><a href="tutor.html">Go play with the Online Python Tutor!</a></h3>
97+
<h3><a href="tutor.html">Start using Online Python Tutor now</a></h3>
11198

11299
</div>
113100

114-
<div class="activityPane" id="solvePane">
115101

116-
<h1>Solve</h1>
117-
<h2>programming problems by writing Python code</h2>
118102

119-
<p>The Online Python Tutor also allows students to practice solving
120-
programming problems like those they would receive for class assignments
121-
or technical job interviews.</p>
103+
</td>
104+
</tr>
122105

123-
<p>It provides web-based interfaces for writing solution and test code,
124-
executing on a series of graded test inputs, and showing what tests
125-
passed and failed.</p>
106+
<tr>
107+
<td width="60%">
126108

127-
<p>The above screenshot shows passed and failed tests. The user can
128-
click on the "Debug me" button besides one of the sad faces to debug why
129-
the program failed on a particular test.</p>
109+
<div class="activityPane" id="embedPane">
130110

131-
<p>Here are some sample practice problems:</p>
111+
<h1>Embed <span class="smallH1">visualizations in digital textbooks and course lessons</span></h1>
132112

133-
<ul>
113+
<p>Using just one line of JavaScript code, you can embed an Online
114+
Python Tutor visualization within your web page. For example, the
115+
HTML textbook for the introductory CS course at UC Berkeley (<a
116+
href="http://www-inst.eecs.berkeley.edu/~cs61a/">CS61A</a>) contains
117+
dozens of embedded visualizations:
134118

135-
<li><a href="question.html?two-sum">Two-sum</a></li>
136-
<li><a href="question.html?reverse">Reverse list</a></li>
137-
<li><a href="question.html?remove-dups">Remove duplicate characters</a></li>
119+
</p>
138120

139-
</ul>
121+
<a href="http://inst.eecs.berkeley.edu/~cs61A-tz/book/chapters/objects.html#nested-pairs">
122+
<img src="opt-v3-cs61a-embed.png" style="border: 1px solid #aaa"/>
123+
</a>
124+
<p>
125+
126+
These visualizations have also been embedded within two other web-based
127+
digital Python textbook projects: <a
128+
href="http://interactivepython.org/courselib/static/thinkcspy/index.html">How
129+
to Think Like a Computer Scientist: Interactive Edition</a> and <a
130+
href="http://cscircles.cemc.uwaterloo.ca/">Computer Science Circles</a>.
131+
These textbooks collectively attract around 16,000 unique viewers per
132+
month and are being used in at least 25 universities around the world.
133+
134+
</p>
135+
136+
</div>
137+
138+
139+
<div id="footer">
140+
141+
<p>Copyright &copy; 2010-2012 <a href="http://www.pgbovine.net/">Philip Guo</a>. All rights reserved.</p>
140142

141143
</div>
142144

143-
<div class="activityPane" id="debugPane">
144145

145-
<h1>Debug</h1>
146-
<h2>existing programs that almost work properly</h2>
146+
</td>
147+
<td width="40%">
147148

148-
<p>Using the Online Python Tutor's bidirectional single-stepping and
149-
data structure visualization capabilities, students can practice
150-
debugging, an important skill which is rarely covered in web-based
151-
programming problems.</p>
149+
<div class="activityPane" id="sharePane">
152150

153-
<p>They can work on problems like, <i>"Change at most 2 lines of code to
154-
make this almost-correct Python program work properly."</i> Here are
155-
some sample debugging problems:</p>
151+
<h1>Share <span class="smallH1">visualizations online</span></h1>
156152

157-
<ul>
153+
<p>To share your current visualization, click the &ldquo;Generate
154+
URL&rdquo; button and send that URL link in an email, social networking
155+
post, or forum thread. When recipients click on that link, they will see
156+
exactly what you are looking at. This is a more effective way for
157+
students to seek assistance than simply copying-and-pasting code.</p>
158158

159-
<li><a href="question.html?debug-ireverse">In-place reverse</a></li>
160-
<li><a href="question.html?debug-bsearch">Binary search</a></li>
161-
<li><a href="question.html?debug-mergesort">Mergesort</a></li>
159+
<p> For example, clicking <a
160+
href="http://www.pythontutor.com/tutor.html#code=%23+find+primes+using+a+for-else+construct%0Afor+n+in+range(2,+10)%3A%0A++++x_range+%3D+range(2,+n)%0A++++for+x+in+x_range%3A%0A++++++++if+n+%25+x+%3D%3D+0%3A%0A++++++++++++break%0A++++else%3A%0A++++++++%23+loop+fell+through+without+finding+a+factor%0A++++++++print(n)&curInstr=43&mode=visualize&cumulative_mode=false&python_version=2">this
161+
link</a> brings you directly to step 44 of 57 in a program to find prime
162+
numbers using the Python <tt>for-else</tt> construct.</p>
162163

163-
</ul>
164+
<p>In the future, we plan to create an authoring environment where you
165+
can add annotations, discussion threads, and even interactive activities
166+
on top of your visualizations.</p>
164167

165168
</div>
166169

167-
</div>
168170

171+
<div class="activityPane" id="detailsPane">
169172

170-
<div id="footer">
173+
<h2>More Details</h2>
171174

172-
<p>Source code and documentation are in this <a
173-
href="https://github.com/pgbovine/OnlinePythonTutor/">GitHub
174-
repository</a>.</p>
175+
<p>
175176

176-
<p>Join ___ (low-traffic) Google Group to receive project announcements.</p>
177+
<ul>
178+
179+
<li/>Supports Python <a href="http://www.python.org/doc/2.7/">2.7</a>
180+
and <a href="http://www.python.org/doc/3.2/">3.2</a> with limited
181+
module imports and no file I/O
182+
183+
<li/>BSD-licensed source code available in this <a
184+
href="https://github.com/pgbovine/OnlinePythonTutor/">GitHub
185+
repository</a>
186+
187+
<li/>Main technologies: Python <tt><a
188+
href="http://docs.python.org/library/bdb.html">bdb</a></tt> debugger
189+
framework for backend execution trace generation, <a
190+
href="http://www.d3js.org/">D3.js</a> for frontend data management and
191+
visualization, <a href="http://www.jsplumb.org/">jsPlumb</a> for
192+
graphical arrow rendering, and <a
193+
href="http://codemirror.net/">CodeMirror</a> for syntax highlighting.
194+
195+
<li/>Join our low-traffic Google Group to receive project announcements.
196+
197+
<li/>To report bugs, email bugs@pythontutor.com
198+
199+
</ul>
177200

178-
<p>
179-
Copyright &copy; 2010-2012 <a href="http://www.pgbovine.net/">Philip
180-
Guo</a> (philip@pgbovine.net). All rights reserved.
181201
</p>
182202

183-
<p>Special thanks to ___</p>
203+
</div>
204+
205+
206+
</td>
207+
208+
</tr>
209+
</table>
184210

185211
</div>
186212

213+
187214
</body>
188215
</html>
189216

‎v3/js/index.js‎

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎v3/tutor.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@
170170

171171
<p>To report a bug, click the 'Generate URL' button, paste the URL along
172172
with a brief error description in an email, and send the email to
173-
philip@pgbovine.net
173+
bugs@pythontutor.com
174174
</p>
175175

176176
<p>

0 commit comments

Comments
 (0)