Lines on a tkinter.Canvas

Pedro Izecksohn izecksohn at yahoo.com
Thu Jun 12 16:33:35 EDT 2014


----- Original Message -----

> From: Gregory Ewing
> To: python-list at python.org
> Sent: Thursday, June 12, 2014 8:38 AM
> Subject: Re: Lines on a tkinter.Canvas
> 
> Pedro Izecksohn wrote:
>>  The Canvas' method create_line turns on at least 2 pixels. But I want 
> to turn
>>  on many single pixels on a Canvas.
> 
> You could try using a 1x1 rectangle instead.

pedro at microboard:~/programming/python/tk/canvas$ diff old/testing.001.py testing.py
19c19
<     self.canvas.create_line (p.x, p.y, p.x, p.y, fill = color)
---
>     self.canvas.create_rectangle (p.x, p.y, p.x, p.y, fill = color)

  The result that I got is: The line drawn by it is not shown.

> However, be aware that either of these will use quite a
> lot of memory per pixel. If you are drawing a very large
> number of pixels, this could cause performance problems.
> In that case, you might want to use a different approach,
> such as creating an image and telling the canvas to display
> the image.

  I did not try this yet.



More information about the Python-list mailing list