Re: [Tutor] trouble with a small Tkinter example

2010-09-21 Thread Emile van Sebille

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


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] trouble with a small Tkinter example

2010-09-21 Thread Chuck Mayers
There is a not-very-obvious 'Download Code' link at the very bottom of the
article.

Direct link:
http://en.literateprograms.org/Special:Downloadcode/Bresenham%27s_line_algorithm_%28Python%29


On Tue, Sep 21, 2010 at 4:13 PM, Emile van Sebille  wrote:


> It looks like they've got you assembling the program from bits and pieces
> as it's presented and reviewed.  Can you post your program as you've
> reassembled it so we can see what's actually coded?
>
> Emile
>
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] trouble with a small Tkinter example

2010-09-21 Thread Emile van Sebille

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.


It looks like they've got you assembling the program from bits and 
pieces as it's presented and reviewed.  Can you post your program as 
you've reassembled it so we can see what's actually coded?


Emile

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] trouble with a small Tkinter example

2010-09-21 Thread Evert Rol
> 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?

It appears that Tkinter (or probably the underling tcl/tk) is smart: if you 
create a line with the same start and end points, it won't draw a line.
Try it: create_line(10, 100, 10, 100, fill='red') won't work.


> 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')


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor