[Python-bugs-list] [Bug #110824] Tkinter canvas blow-up: bbox(ALL) == None (PR#133)
noreply@sourceforge.net
noreply@sourceforge.net
Wed, 9 Aug 2000 11:10:30 -0700
Bug #110824, was updated on 2000-Aug-01 14:10
Here is a current snapshot of the bug.
Project: Python
Category: Tkinter
Status: Closed
Resolution: Wont Fix
Bug Group: 3rd Party
Priority: 5
Summary: Tkinter canvas blow-up: bbox(ALL) == None (PR#133)
Details: Jitterbug-Id: 133
Submitted-By: aa8vb@yahoo.com
Date: Thu, 18 Nov 1999 13:34:44 -0500 (EST)
Version: 1.5.2
OS: IRIX 6.5
From: "Fredrik Lundh" <fredrik@pythonware.com>
Date: Tue, 2 Nov 1999 09:53:17 +0100
Subject: Re: Tkinter canvas blow-up: bbox(ALL) == None
Randall Hopper <aa8vb@yahoo.com> wrote:
> Apparently if the bounds of the items in a Tk canvas widget exceed
> MAXINT, bbox(ALL) returns None. The attached Python script demonstrates
> this.
>
> Intuitively it seems like this is a bug since the contents of the
> canvas are maintained in floating point; integer bounds shouldn't be
> involved, should they?
>
> Is this a Tk bug or a Tkinter bug?
both.
Tkinter uses _getints instead of _getdoubles to
convert the bounding box to a tuple...
...but the reason you get None instead of an over-
flow error is that Tk returns an empty string in this
case (at least in 8.0.5).
-------------------------------------------------------------------------------
#!/usr/bin/env python
#
# canvas_test.py - Demonstrates a bug in Tkinter's Canvas widget
# where bbox = None when the bbox exceeds signed MAXINT
# (2^31 on most machines).
from Tkinter import *
#
# Create widgets
#
root = Tk()
canvas = Canvas( root, width = 300, height = 300 )
canvas.pack()
canvas.create_rectangle( (-100,-100,100,100),
outline = "#008000", fill="#800000", width = 3 )
canvas.create_line( (-100,-100,100,100),
fill="blue", width=3 )
canvas.create_line( (-100,100,100,-100),
fill="blue", width=3 )
canvas.config( scrollregion = canvas.bbox( ALL ) )
#
# Zoom the canvas until it's bounds get toasted because they exceed MAXINT
#
def TimerCB( canvas=canvas ):
old = canvas.bbox( ALL )
canvas.scale( ALL, 0.0, 0.0, 2.0, 2.0 )
new = canvas.bbox( ALL )
print "Old = %s, New = %s" % ( old, new )
if new == None:
raise SystemError, "canvas's bbox is toast (exceeds signed MAXINT)"
canvas.after( 300, TimerCB )
print "CANVAS ZOOM BLOW-UP TEST:\n"
canvas.after( 1500, TimerCB )
root.mainloop()
====================================================================
Audit trail:
Thu Nov 18 14:06:40 1999 guido changed notes
Thu Nov 18 14:06:41 1999 guido moved from incoming to request
Follow-Ups:
Date: 2000-Aug-01 14:11
By: none
Comment:
bbox should use floats instead of ints, since Tcl/Tk can return them.
-------------------------------------------------------
Date: 2000-Aug-09 11:10
By: effbot
Comment:
this is a Tk feature. the "canvas bbox" command uses integers internally, so there's not much we can do about it :-(
-------------------------------------------------------
For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=110824&group_id=5470