@Dave, no problem. I am using gedit to write the files and have it set to translate tabs into 4 spaces which is what was recommended to me as the right amount of indenting for python scripts.
On Monday, 13 January 2014 08:15:08 UTC, Norman Elliott wrote: > First let me say I have not done much python programming! > > I am running Python 2.7.3. > > I am trying to use python as a front end to a simple oscilloscope. > > Ultimately I intend to use it with my micropython board. > > > > At the moment I am just developing it. All it does is use a module I found > called graphics.py to create a window and display randomly generated data. > > > > Each time it goes through the outer loop it gets slower and slower. > > I put in a small delay just so I could observe what is happening and for the > first line it draws it takes about a second. If I set it to loop 20 times the > final loop takes more than 6 seconds. > > Can anyone explain what I am doing wrong please? > > Here is the code: > > [code] > > #!/usr/bin/python > > from graphics import * > > import random > > import time > > > > xpos=1200 > > ypos=400 > > ypnt=ypos/2 > > pos=1 > > #setBackground("white") > > def main(): > > win = GraphWin("My Circle", xpos, ypos) > > # win.setBackGround('white') > > for y in range(1,5): > > cir2 = Circle(Point(xpos/2,20), 10) > > cir2.setFill("white") > > cir2.draw(win) > > message = Text(Point(win.getWidth()/2, 20), y) > > message.draw(win) > > j = random.randint(1,ypos) > > for x in range(1,xpos): > > updown = random.randint(0,1) > > if updown: > > j=j+1 > > else: > > j=j-1 > > if j <1: > > j=ypos/2 > > if j>ypos-1: > > j=ypos/2 > > win.plot(x,j,"red") > > time.sleep(.0001) > > > > main() > > time.sleep(5) > > [/code] -- https://mail.python.org/mailman/listinfo/python-list