Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #63814 > unrolled thread

plotting slows down

Started bynorman.elliott@gmail.com
First post2014-01-13 00:15 -0800
Last post2014-01-14 09:06 -0800
Articles 18 — 9 participants

Back to article view | Back to comp.lang.python


Contents

  plotting slows down norman.elliott@gmail.com - 2014-01-13 00:15 -0800
    Re:plotting slows down Dave Angel <davea@davea.name> - 2014-01-13 08:26 -0500
      Re:plotting slows down Steven D'Aprano <steve@pearwood.info> - 2014-01-13 20:33 +0000
        Re:plotting slows down Dave Angel <davea@davea.name> - 2014-01-14 04:39 -0500
        Re: plotting slows down Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-01-14 08:48 -0500
    Re: plotting slows down Norman Elliott <norman.elliott@gmail.com> - 2014-01-13 05:32 -0800
    Re: plotting slows down Norman Elliott <norman.elliott@gmail.com> - 2014-01-13 05:45 -0800
      Re: plotting slows down Dave Angel <davea@davea.name> - 2014-01-14 04:32 -0500
    Re: plotting slows down Ian Kelly <ian.g.kelly@gmail.com> - 2014-01-13 10:39 -0700
    Re: plotting slows down Chris Angelico <rosuav@gmail.com> - 2014-01-14 04:45 +1100
    Re: plotting slows down Dave Angel <davea@davea.name> - 2014-01-13 13:05 -0500
      Re: plotting slows down Norman Elliott <norman.elliott@gmail.com> - 2014-01-13 10:33 -0800
    Re: plotting slows down Ian Kelly <ian.g.kelly@gmail.com> - 2014-01-13 11:05 -0700
    Re: plotting slows down Terry Reedy <tjreedy@udel.edu> - 2014-01-13 16:42 -0500
    Re: plotting slows down Norman Elliott <norman.elliott@gmail.com> - 2014-01-14 05:04 -0800
      Re: plotting slows down Rustom Mody <rustompmody@gmail.com> - 2014-01-14 05:15 -0800
        Re: plotting slows down Chris Angelico <rosuav@gmail.com> - 2014-01-15 00:36 +1100
    Re: plotting slows down Norman Elliott <norman.elliott@gmail.com> - 2014-01-14 09:06 -0800

#63814 — plotting slows down

Fromnorman.elliott@gmail.com
Date2014-01-13 00:15 -0800
Subjectplotting slows down
Message-ID<4c51b5e8-e7b4-4a09-95d4-daefbfe27b28@googlegroups.com>
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]

[toc] | [next] | [standalone]


#63825

FromDave Angel <davea@davea.name>
Date2014-01-13 08:26 -0500
Message-ID<mailman.5403.1389619459.18130.python-list@python.org>
In reply to#63814
 norman.elliott@gmail.com Wrote in message:
> 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 *

First things first. what operating system are you using,  and
 where did you get the mysterious graphics. py?  Thanks for
 telling us python 2.7.3

Next, please repost any source code with indentation preserved. 
 Your message shows it all flushed to the left margin,  probably
 due to posting in html mode. Use text mode here.

Finally,  since you seem to be using googlegroups,  please make
 sure you don't double space your quotes. See. wiki.python.org/moi
n/GoogleGroupsPython

> 

-- 
DaveA



----Android NewsGroup Reader----
http://www.piaohong.tk/newsgroup

[toc] | [prev] | [next] | [standalone]


#63861

FromSteven D'Aprano <steve@pearwood.info>
Date2014-01-13 20:33 +0000
Message-ID<52d44d86$0$6599$c3e8da3$5496439d@news.astraweb.com>
In reply to#63825
On Mon, 13 Jan 2014 08:26:11 -0500, Dave Angel wrote:

> norman.elliott@gmail.com Wrote in message:

>> [code]
>> #!/usr/bin/python
>> from graphics import *
> 
> First things first. what operating system are you using,  and
>  where did you get the mysterious graphics. py?  Thanks for telling us
>  python 2.7.3
> 
> Next, please repost any source code with indentation preserved.

He did. If you look at the original message as posted to python-
list@python.org and comp.lang.python, e.g. here:

https://mail.python.org/pipermail/python-list/2014-January/664430.html

you will see that the message is correctly indented with tabs.

>  Your message shows it all flushed to the left margin,  probably due to
>  posting in html mode. Use text mode here.

Looks like perhaps Gmane is stripping tabs from their mirror. You should 
report that as a bug to them.



-- 
Steven

[toc] | [prev] | [next] | [standalone]


#63881

FromDave Angel <davea@davea.name>
Date2014-01-14 04:39 -0500
Message-ID<mailman.5441.1389692237.18130.python-list@python.org>
In reply to#63861
 Steven D'Aprano <steve@pearwood.info> Wrote in message:
> On Mon, 13 Jan 2014 08:26:11 -0500, Dave Angel wrote:
> 
>> norman.elliott@gmail.com Wrote in message:
> 
>>> [code]
>>> #!/usr/bin/python
>>> from graphics import *
>> 
>> First things first. what operating system are you using,  and
>>  where did you get the mysterious graphics. py?  Thanks for telling us
>>  python 2.7.3
>> 
>> Next, please repost any source code with indentation preserved.
> 
> He did. If you look at the original message as posted to python-
> list@python.org and comp.lang.python, e.g. here:
> 
> https://mail.python.org/pipermail/python-list/2014-January/664430.html
> 
> you will see that the message is correctly indented with tabs.
> 
>>  Your message shows it all flushed to the left margin,  probably due to
>>  posting in html mode. Use text mode here.
> 
> Looks like perhaps Gmane is stripping tabs from their mirror. You should 
> report that as a bug to them.
> 
> 
> 

I just went to my Linux box and fired up thunderbird.  When it
 reads the same message from gmane,  it gets the tabs. So
 apparently it's this Android Newsgroups Reader that's buggy.
 

-- 
DaveA



----Android NewsGroup Reader----
http://www.piaohong.tk/newsgroup

[toc] | [prev] | [next] | [standalone]


#63902

FromDennis Lee Bieber <wlfraed@ix.netcom.com>
Date2014-01-14 08:48 -0500
Message-ID<mailman.5456.1389707327.18130.python-list@python.org>
In reply to#63861
On Tue, 14 Jan 2014 04:39:11 -0500 (EST), Dave Angel <davea@davea.name>
declaimed the following:


>I just went to my Linux box and fired up thunderbird.  When it
> reads the same message from gmane,  it gets the tabs. So
> apparently it's this Android Newsgroups Reader that's buggy.
> 

	Perhaps even more than you think... Your responses are showing up here
with a 1-space hanging indent; as if it considers the space when
word-wrapping to be the beginning of a word, rather than the end of a word.
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

[toc] | [prev] | [next] | [standalone]


#63826

FromNorman Elliott <norman.elliott@gmail.com>
Date2014-01-13 05:32 -0800
Message-ID<3e0dcc90-a45f-4025-9cea-cf3c3f964178@googlegroups.com>
In reply to#63814
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]

[toc] | [prev] | [next] | [standalone]


#63827

FromNorman Elliott <norman.elliott@gmail.com>
Date2014-01-13 05:45 -0800
Message-ID<00281afe-0a5e-4d9a-92ce-c341bbcf9331@googlegroups.com>
In reply to#63814
I am running ubuntu 12.04 with all updates installed.

I got the graphics here:
http://mcsp.wartburg.edu/zelle/python/graphics/graphics/index.html

I cannot see how to change from html to text mode in chromium or within the group.

I read the link about double spacing so I will watch out for it.

[toc] | [prev] | [next] | [standalone]


#63879

FromDave Angel <davea@davea.name>
Date2014-01-14 04:32 -0500
Message-ID<mailman.5440.1389691810.18130.python-list@python.org>
In reply to#63827
 Norman Elliott <norman.elliott@gmail.com> Wrote in message:
> 
> I cannot see how to change from html to text mode in chromium or within the group.
> 

You already did post in text mode, my error. The new newsreader
 I'm using apparently eats tabs.

-- 
DaveA



----Android NewsGroup Reader----
http://www.piaohong.tk/newsgroup

[toc] | [prev] | [next] | [standalone]


#63843

FromIan Kelly <ian.g.kelly@gmail.com>
Date2014-01-13 10:39 -0700
Message-ID<mailman.5417.1389634787.18130.python-list@python.org>
In reply to#63814
On Mon, Jan 13, 2014 at 6:26 AM, Dave Angel <davea@davea.name> wrote:
> Next, please repost any source code with indentation preserved.
>  Your message shows it all flushed to the left margin,  probably
>  due to posting in html mode. Use text mode here.

That's odd, the message that I got includes proper indentation and is
plain text, not html.

[toc] | [prev] | [next] | [standalone]


#63844

FromChris Angelico <rosuav@gmail.com>
Date2014-01-14 04:45 +1100
Message-ID<mailman.5418.1389635116.18130.python-list@python.org>
In reply to#63814
On Tue, Jan 14, 2014 at 4:39 AM, Ian Kelly <ian.g.kelly@gmail.com> wrote:
> On Mon, Jan 13, 2014 at 6:26 AM, Dave Angel <davea@davea.name> wrote:
>> Next, please repost any source code with indentation preserved.
>>  Your message shows it all flushed to the left margin,  probably
>>  due to posting in html mode. Use text mode here.
>
> That's odd, the message that I got includes proper indentation and is
> plain text, not html.

Also what I saw. Dave, do you get the newsgroup or the mailing list? I
get the mailing list - it's possible the HTML version got stripped by
Mailman.

ChrisA

[toc] | [prev] | [next] | [standalone]


#63845

FromDave Angel <davea@davea.name>
Date2014-01-13 13:05 -0500
Message-ID<mailman.5419.1389636241.18130.python-list@python.org>
In reply to#63814
 Chris Angelico <rosuav@gmail.com> Wrote in message:
> On Tue, Jan 14, 2014 at 4:39 AM, Ian Kelly <ian.g.kelly@gmail.com> wrote:
>> On Mon, Jan 13, 2014 at 6:26 AM, Dave Angel <davea@davea.name> wrote:
>>> Next, please repost any source code with indentation preserved.
>>>  Your message shows it all flushed to the left margin,  probably
>>>  due to posting in html mode. Use text mode here.
>>
>> That's odd, the message that I got includes proper indentation and is
>> plain text, not html.
> 
> Also what I saw. Dave, do you get the newsgroup or the mailing list? I
> get the mailing list - it's possible the HTML version got stripped by
> Mailman.
> 

I'm using gmane newsgroup, and recently switched to the Android
 Newsgroup Reader. Previously was using Groundhog, which seemed to
 eat the body of any message containing an html part. (Though
 strangely it showed the footer in the tutor newsgroup). This one
 was mentioned byAlan, and she far has seemed much
 better.

-- 
DaveA



----Android NewsGroup Reader----
http://www.piaohong.tk/newsgroup

[toc] | [prev] | [next] | [standalone]


#63849

FromNorman Elliott <norman.elliott@gmail.com>
Date2014-01-13 10:33 -0800
Message-ID<c37a442d-4011-4737-8f4c-a0b9a1f13359@googlegroups.com>
In reply to#63845
On Monday, 13 January 2014 18:05:52 UTC, Dave Angel  wrote:
> Chris Angelico  Wrote in message:
> 


Well Ian's suggestion has really done the job. Now each iteration takes just 0.14 seconds now.
changed to:
[code]
win = GraphWin("My Circle", xpos, ypos, autoflush=False)
[/code]

and added 
[code]
update()
[/code]

immediately after the line
[code]
for y in range(1,12):
[/code]

previously the first iteration took 0.48 seconds and the the 10th 4.76

[toc] | [prev] | [next] | [standalone]


#63846

FromIan Kelly <ian.g.kelly@gmail.com>
Date2014-01-13 11:05 -0700
Message-ID<mailman.5420.1389636350.18130.python-list@python.org>
In reply to#63814
On Mon, Jan 13, 2014 at 1:15 AM,  <norman.elliott@gmail.com> 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?

I wager the problem is in the "range(1, xpos)" inner loop.  Each time
this runs the win.plot() call adds a 1-pixel line to the underlying Tk
canvas.  These 1-pixel lines are never deleted, so they accumulate
over each outer loop.  Every time a new object is drawn, the canvas
has to process all of the lines that have been drawn in order to
redraw itself, and so it gets slower and slower.

One simple fix you might try to improve the rendering efficiency is to
disable the autoflush option documented here:

http://mcsp.wartburg.edu/zelle/python/graphics/graphics/node14.html

And then call the module-level update() function after each iteration
of the outer loop to force things to redraw.  In order to
realistically use this module for animation it looks like you will at
some point need to keep the number of graphics objects under some
constant.  To do this you could either reuse the existing objects by
calling their "move" method to reposition them as needed, or simply
remove them from the plot with the "undraw" method and draw new
objects in their place.  See:

http://mcsp.wartburg.edu/zelle/python/graphics/graphics/node3.html

If this still isn't fast enough for the number of objects you're
drawing, then you may just need to find a new drawing package, as this
one appears to be designed for teaching rather than efficiency.

[toc] | [prev] | [next] | [standalone]


#63865

FromTerry Reedy <tjreedy@udel.edu>
Date2014-01-13 16:42 -0500
Message-ID<mailman.5431.1389649355.18130.python-list@python.org>
In reply to#63814
On 1/13/2014 12:45 PM, Chris Angelico wrote:
> On Tue, Jan 14, 2014 at 4:39 AM, Ian Kelly <ian.g.kelly@gmail.com> wrote:
>> On Mon, Jan 13, 2014 at 6:26 AM, Dave Angel <davea@davea.name> wrote:
>>> Next, please repost any source code with indentation preserved.
>>>   Your message shows it all flushed to the left margin,  probably
>>>   due to posting in html mode. Use text mode here.
>>
>> That's odd, the message that I got includes proper indentation and is
>> plain text, not html.
>
> Also what I saw. Dave, do you get the newsgroup or the mailing list? I
> get the mailing list - it's possible the HTML version got stripped by
> Mailman.

I am reading via gmane. Viewing the source, there is no html.
BUT, indents are with tabs, not spaces. Some readers just delete tabs, 
as there is no standard for conversion to spaces, especially with 
proportional fonts. Thunderbird used to do this, but now uses tab stops 
every 8 spaces (maybe because a switched to a fixed font?) This means 
that the first tab gives an indent 8 chars in the original post, 6 in 
the first quotation, and, I presume, 4 in a second quotation, etc. It 
works better to post code with space indents.

-- 
Terry Jan Reedy

[toc] | [prev] | [next] | [standalone]


#63896

FromNorman Elliott <norman.elliott@gmail.com>
Date2014-01-14 05:04 -0800
Message-ID<de11189d-f662-4019-858f-94813520b829@googlegroups.com>
In reply to#63814
@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]

[toc] | [prev] | [next] | [standalone]


#63897

FromRustom Mody <rustompmody@gmail.com>
Date2014-01-14 05:15 -0800
Message-ID<a9cd5c2c-a919-4614-905e-164d0385c959@googlegroups.com>
In reply to#63896
On Tuesday, January 14, 2014 6:34:43 PM UTC+5:30, Norman Elliott wrote:
> @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.

Dunno what you mean by 'translate'
If that means actually replace the characters, then that will cause minimum problems

However it can also mean that gedit sets tabstops at 4 character intervals
Which will mean you will see 4 characters (in gedit) and everyone else will see a 
tab. This is a recipe for trouble.

[toc] | [prev] | [next] | [standalone]


#63900

FromChris Angelico <rosuav@gmail.com>
Date2014-01-15 00:36 +1100
Message-ID<mailman.5455.1389706604.18130.python-list@python.org>
In reply to#63897
On Wed, Jan 15, 2014 at 12:15 AM, Rustom Mody <rustompmody@gmail.com> wrote:
> However it can also mean that gedit sets tabstops at 4 character intervals
> Which will mean you will see 4 characters (in gedit) and everyone else will see a
> tab. This is a recipe for trouble.

Not a recipe for trouble normally, it's just that some people's
clients can't see them. So keep using tabs if you want to, but be
prepared to search-and-replace them to spaces prior to posting code.
Though I think the fault is with the client(s) that can't see tabs,
and they're the ones that ought to be fixed.

ChrisA

[toc] | [prev] | [next] | [standalone]


#63918

FromNorman Elliott <norman.elliott@gmail.com>
Date2014-01-14 09:06 -0800
Message-ID<5809ea9f-401b-4011-907d-72addb3a2b26@googlegroups.com>
In reply to#63814
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]

Okay, maybe I misunderstood what it was doing. I have checked and I will do a find and replace of the tabs with 4 spaces in future. 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web