The origin for x,y pairs sent to the Canvas items is off-screen by the sum of borderwidth bd and
highlightthickness hT. The accompanying program shows this and includes three functions which can be
used in workarounds. I just hope the upload facility works this time.
A canvas with exaggerated values for bd and hT is shown to illustrate the problem. On it, a full-screen
open rectangle ((0-to width-1) by 0-to-(height-1)) is shown in red, and it is partly off-screen. A blue
rectangle of the same coordinates is sent through UsrToCnv(), which uses .cget() to fetch up-to-date
values for bd and hT (which can of course be updated on the fly) and translates the user's canvas item
back where it belongs.
Clicking on the canvas illustrates the use of CnvToUsr, sending a tuple (event.x, event.y) through the
reverse of the above translation so that it matches the user's expectations.
If these functions or their equivalents are not already available, you have my permission to offer these
as workarounds while someone investigates the problem.
I recommend that similar trials be performed on Tcl/Tk or PERL/Tk to see if the problem lies in Tkinter
or even deeper in the mass of code.
I'm a Python beginner so can't help with a project to fix it, but I'd like to be kept informed of any
progress or decisions, if that's not too much trouble.
Roy Keir
|