summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-12-27 15:40:31 (GMT)
committerGuido van Rossum <guido@python.org>1996-12-27 15:40:31 (GMT)
commit178ff353e88c41f6f3d26f3f6e4d9772a5dc7713 (patch)
treef3b7a0b1bc7ad542260b60a985990891f3bf371f
parent8371013f9a50cf0fb38ba39dce1d83c6543ce9d3 (diff)
downloadcpython-178ff353e88c41f6f3d26f3f6e4d9772a5dc7713.zip
cpython-178ff353e88c41f6f3d26f3f6e4d9772a5dc7713.tar.gz
cpython-178ff353e88c41f6f3d26f3f6e4d9772a5dc7713.tar.bz2
Fix bogus implementation of Group.bind().
Added unbind() to CanvasItem and Group classes.
-rw-r--r--Lib/lib-tk/Canvas.py8
-rwxr-xr-xLib/tkinter/Canvas.py8
2 files changed, 12 insertions, 4 deletions
diff --git a/Lib/lib-tk/Canvas.py b/Lib/lib-tk/Canvas.py
index 6eccd4d..ad0cc56 100644
--- a/Lib/lib-tk/Canvas.py
+++ b/Lib/lib-tk/Canvas.py
@@ -43,6 +43,8 @@ class CanvasItem:
return (x1, y1), (x2, y2)
def bind(self, sequence=None, command=None):
return self.canvas.tag_bind(self.id, sequence, command)
+ def unbind(self, sequence):
+ self.canvas.tag_bind(self.id, sequence, '')
def config(self, cnf={}, **kw):
return self.canvas.itemconfig(self.id, _cnfmerge((cnf, kw)))
def coords(self, pts = ()):
@@ -140,8 +142,10 @@ class Group:
self._do('addtag', 'withtag', tagOrId)
def bbox(self):
return self._getints(self._do('bbox'))
- def bind(self, sequence=None, command=None): # XXX args?
- return self._do('bind', sequence, command)
+ def bind(self, sequence=None, command=None):
+ return self.canvas.tag_bind(self.id, sequence, command)
+ def unbind(self, sequence):
+ self.canvas.tag_bind(self.id, sequence, '')
def coords(self, *pts):
return self._do('coords', pts)
def dchars(self, first, last=None):
diff --git a/Lib/tkinter/Canvas.py b/Lib/tkinter/Canvas.py
index 6eccd4d..ad0cc56 100755
--- a/Lib/tkinter/Canvas.py
+++ b/Lib/tkinter/Canvas.py
@@ -43,6 +43,8 @@ class CanvasItem:
return (x1, y1), (x2, y2)
def bind(self, sequence=None, command=None):
return self.canvas.tag_bind(self.id, sequence, command)
+ def unbind(self, sequence):
+ self.canvas.tag_bind(self.id, sequence, '')
def config(self, cnf={}, **kw):
return self.canvas.itemconfig(self.id, _cnfmerge((cnf, kw)))
def coords(self, pts = ()):
@@ -140,8 +142,10 @@ class Group:
self._do('addtag', 'withtag', tagOrId)
def bbox(self):
return self._getints(self._do('bbox'))
- def bind(self, sequence=None, command=None): # XXX args?
- return self._do('bind', sequence, command)
+ def bind(self, sequence=None, command=None):
+ return self.canvas.tag_bind(self.id, sequence, command)
+ def unbind(self, sequence):
+ self.canvas.tag_bind(self.id, sequence, '')
def coords(self, *pts):
return self._do('coords', pts)
def dchars(self, first, last=None):