<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial,helvetica,sans-serif;font-size:10pt"><div style="font-family: arial,helvetica,sans-serif; font-size: 10pt;">David,<br><br>For output graphics, you might want to have a look at <a rel="nofollow" target="_blank" href="http://www.pygame.org/">Pygame</a>.&nbsp;
It is a wrapper for the SDL library.&nbsp; It has functionality for creating
graphics windows, drawing, sprites, etc.&nbsp; But what might be of interest
for you is the simple set_at(x,y) method, to set the color of
individual pixels in a window.<br><br>I have found the Pygame documentation to be pretty good.<br><br>Here is a simple example of plotting a sinewave using set_at()<br><br>#-----------------------------<br>import pygame, sys, math<br>screen = pygame.display.set_mode([640,480])<br>for x in range(0, 640):<br>&nbsp;&nbsp;&nbsp; y = int(math.sin(x/640.0 * 4 * math.pi) * 200 + 240)<br>&nbsp;&nbsp;&nbsp;
 screen.set_at([x, y],[255,0,0])<br>pygame.display.flip()<br>while True:<br>&nbsp;&nbsp;&nbsp; for event in pygame.event.get():<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if event.type == pygame.QUIT:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sys.exit()<br>#------------------------------<br><br>Warren Sande<br><br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">----- Original Message ----<br>From: David MacQuigg &lt;macquigg@ece.arizona.edu&gt;<br>To: edu-sig@python.org<br>Sent: Monday, March 10, 2008 10:28:21 PM<br>Subject: [Edu-sig] Introducing Python to Engineering Students<br><br>I've 
been 
asked 
to 
give 
an 
intro 
to 
Python 
for 

freshman 
class 
with 
150 
students 
at 
University 
of 
Arizona.&nbsp; 
The 
class 
is 
taught 
in 
the 
Electrical 
and 
Computer 
Engineering 
Department, 
and 
is 
titled 
Computer 
Programming 
for 
Engineering 
Applications. 
The 
language 
is 

(Hanly 
&amp; 
Koffman, 
Problem 
Solving 
and 
Program 
Design 
in 
C).<br><br>I 
think 

nice 
way 
to 
do 
this 
will 
be 
an 
application 
where 
we 
can 
show 
the 
advantages 
of 
both 
languages 

the 
computation 
of 
Mandelbrot 
images 
<a href="http://en.wikipedia.org/wiki/Mandelbrot_set" target="_blank">http://en.wikipedia.org/wiki/Mandelbrot_set</a>.&nbsp; 
Python 
will 
provide 
the 
high-level 
"glue" 
which 
brings 
everything 
together 
in 

nice 
programming 
environment, 
and 

will 
provide 
the 
raw 
power 
for 
the 
loop 
that 
actually 
computes 
the 
pixels.&nbsp; 
My 
initial 
tests 
show 
this 
loop 
running 
about 
100 
times 
faster 
in 

than 
in 
Python.&nbsp; <br><br>The 
challenge 
is 
to 
do 
this 
without 
overwhelming 
the 
students.&nbsp; 
The 
plan 
is 
to 
make 
everything 
as 
simple 
as 
possible, 
just 
follow 
the 
instructions, 
except 
the 
loop 
itself, 
which 
the 
students 
will 
write 
in 
C, 
based 
on 
what 

have 
written 
in 
Python.&nbsp; 
See 
<a href="http://ece.arizona.edu/%7Eedatools/ece175/projects/mandelbrots/mbrotHW.html" target="_blank">http://ece.arizona.edu/~edatools/ece175/projects/mandelbrots/mbrotHW.html</a>.<br><br>Suggestions 
are 
welcome.&nbsp; 
Has 
anyone 
done 
something 
like 
this 
before?&nbsp; 
Can 
you 
improve 
on 
my 
code 
(I'm 
not 

Python 
expert), 
or 
even 
suggest 
something 
entirely 
different?<br><br>There 
is 
one 
major 
piece 

would 
like 
to 
add 
to 
what 

have 
so 
far 

output 
graphics.&nbsp; 
This 
demo 
would 
really 
be 
cool 
if 
the 
students 
could 
see 
these 
glorious 
images 
appear 
on 
their 
screen 
instead 
of 
an 
array 
of 
numbers.&nbsp; 

looked 
at 
the 
Python 
Imaging 
Library 
<a href="http://www.pythonware.com/products/pil/index.htm" target="_blank">http://www.pythonware.com/products/pil/index.htm</a>, 
and 

don't 
see 
any 
examples 
that 

can 
work 
from 
in 
converting 
an 
array 
of 
numbers 
into 
an 
image, 
just 

lot 
of 
dense 
reference 
material 
that 
assumes 

already 
know 
these 
image 
data 
formats.&nbsp; 
Maybe 
there 
is 

simpler 
way.&nbsp; 
Help 
from 
someone 
with 
experience 
in 
Python 
graphics 
would 
be 
most 
appreciated.<br><br>-- 
Dave <br><br><br><br>_______________________________________________<br>Edu-sig 
mailing 
list<br><a ymailto="mailto:Edu-sig@python.org" href="mailto:Edu-sig@python.org">Edu-sig@python.org</a><br><a href="http://mail.python.org/mailman/listinfo/edu-sig" target="_blank">http://mail.python.org/mailman/listinfo/edu-sig</a><br></div><br></div></div></body></html>