[Tutor] trouble with a small Tkinter example

Emile van Sebille emile at fenx.com
Tue Sep 21 23:43:16 CEST 2010


On 9/21/2010 1:50 PM Chuck Mayers said...
> Hello,
>
> I'm having trouble with this small example program:
>
> http://en.literateprograms.org/Bresenham%27s_line_algorithm_%28Python%29
>
> When I run it, I only get a blank grey window. I'm running Python 2.6 under
> Windows XP.
>
> If there's a problem with the code, I can't see it... it seems like it
> should work. Can anyone else try this and see if it works for them?
>
>
> If I stick this line in before the loop, it does draw a red line, so I know
> my copy of Python/Tkinter is working:
> canvas.create_line(10, 100, 5, 50 , fill='red')


Using this form of the line,

canvas.create_line(xstart, ystart, xend, yend, fill="red")

seems to do it, although I can't say what versions allowed the author to 
(apparently successfully) write

canvas.draw_line(xstart, ystart, xend, yend, color="blue")

HTH,

Emile




More information about the Tutor mailing list