[Tkinter-discuss] (0,0) off the visible area of a Canvas

Michael Lange klappnase at web.de
Mon Sep 12 12:24:21 CEST 2005


On Sun, 11 Sep 2005 22:08:04 -0400
Bill Barksdale <bill at billbarksdale.com> wrote:

> I am sure this must be a common question but I couldn't find anything 
> about it.
> 
> When I run the following on my system, the first line appears cut off 
> and the second line doesn't appear at all.  I believe this is because 
> (0,0) is not part of the visible area of a canvas, and that it starts 
> instead at (3,3) or thereabouts.  How can I fix this?
> 
> import Tkinter as TK
> root = TK.Tk()
> canv = TK.Canvas(root,width=100,height=100,bg='red')
> canv.pack()
> canv.create_line(0,100,100,0)
> canv.create_line(0,0,0,100)
> 
Hi Bill,

I think the line is being hidden under the Canvases border, so you can try:

    canv.configure(bd=0, highlightthickness=0)

and if you need a decorative border pack the canvas into another Frame.

I hope this helps

Michael


More information about the Tkinter-discuss mailing list