[Python-bugs-list] [ python-Bugs-701116 ] Bypassing upload failures. Tkinter origin-offset problem.

SourceForge.net noreply@sourceforge.net
Mon, 10 Mar 2003 12:53:40 -0800


Bugs item #701116, was opened at 2003-03-10 13:53
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=701116&group_id=5470

Category: Tkinter
Group: Python 2.2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Roy Keir (newbieroy)
Assigned to: Nobody/Anonymous (nobody)
Summary: Bypassing upload failures.  Tkinter origin-offset problem. 

Initial Comment:
I can't find mention of this in any FAQ or in your project titles.  Since I have received a number for another 
problem and not for this one, I assume that even this part of the message was bagged when the upload 
came back with "file had no data".  If not, please forgive the inadvertent spamming.

If the user asks for a canvas of a given size, then uses coordinates within the given limits, I believe the 
user will expect to see everything sent using create_<item>() calls.  This is not the case.  There is a 
band up the left side and another across the top of the canvas of size 'borderwidth + highlightthickness' 
that appears to be part of the canvas but is instead a dead zone.  Apparently what should have been the 
canvas origin has been moved to draw the border and the highlight zone, then not restored.  As a Python 
beginner, I was baffled by this.  Lundh's Intro has very cryptic remarks about those options, but even 
looking back with some understanding of the problem, I find them Hopelessly inadequate.

The problem may be in Tk itself.  A quick experiment in Tck/Tk or PERL/Tk should tell.

For myself, I had to solve the problem without spending months or years, so I wrote three functions that 
allow me to proceed.  Uploads didn't get these to you, and apparently killed the rest of the message.  Not 
good advertising for Source Forge or for whoever coded the upload facility.  The function calls are:

def UsrToCnv(xyTuple, cnvsInstance):
def CnvToUsr(xyTuple, cnvsInstance):
def tupInTupOut(xyTuple, xOffset, yOffset):

   Typical usage in painting canvas items:
c       = Canvas(f, width = 100, height = 75, etc.
sq      = (0,0,  0,74, 99,74, 99,0)
c.create_polygon(UsrToCnv(sq, c), outline = "blue", fill = "") 
  and in the other direction:
def callClick(event):
    CnvToUsr((event.x, event.y), event.widget)
I'll be happy to submit the code for this or for a graphics program that exposes the problem.  Just ask.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=701116&group_id=5470