Weird Tk Canvas coordinate issue

Tim Shannon shannon.timothy at
Mon Apr 6 21:37:41 CEST 2009

I'm new to python, so keep that in mind.

I have a tk Canvas that I'm trying to draw on, and I want to start my
drawing at an offset (from 0) location.  So I can tweak this as I code, I
set this offset as a class level variable:

def ClassName:
    OFFSET = 20

    def __init__(self, master)):
        self.canvas = Canvas(master)
                                     300 + self.OFFSET,
                                     300 + self.OFFSET,

The weird thing is, it doesn't offset.  If I set my offset to 100000, it
still starts drawing at 0,0.
Here's the really weird part (at least to me), if I put a print line right
about my drawing statements to print the value of the offset, it works like
it should, and offsets the drawing.
If I remove the print line, the offset goes away.

This makes no sense to me.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list