diff options
author | Guido van Rossum <guido@python.org> | 2000-10-06 00:38:51 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2000-10-06 00:38:51 (GMT) |
commit | 00236f38dabd16ffe5da4d75664f051c37833aa5 (patch) | |
tree | 456a50c52c57863c9b944119c39885b00fe577ca /Lib/lib-tk | |
parent | c54d19043a595679f253a55e46fda2910f513c52 (diff) | |
download | cpython-00236f38dabd16ffe5da4d75664f051c37833aa5.zip cpython-00236f38dabd16ffe5da4d75664f051c37833aa5.tar.gz cpython-00236f38dabd16ffe5da4d75664f051c37833aa5.tar.bz2 |
[ Bug #110677 ] PRIVATE: various minor Tkinter things (PR#388)
http://sourceforge.net/bugs/?func=detailbug&group_id=5470&bug_id=110677
Canvas.CanvasItem & Canvas.Group:
- bind lacks an optional "add" param
- unbind lacks an optional "funcid" param
- tkraise/lower should call self.canvas.tag_XXXX
(markus.oberhumer@jk.uni-linz.ac.at)
Note: I'm *not* fixing "bbox() return value is inconsistent with
Canvas.bbox()" -- it might break existing code.
Diffstat (limited to 'Lib/lib-tk')
-rw-r--r-- | Lib/lib-tk/Canvas.py | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/Lib/lib-tk/Canvas.py b/Lib/lib-tk/Canvas.py index 3753274..e8b3365 100644 --- a/Lib/lib-tk/Canvas.py +++ b/Lib/lib-tk/Canvas.py @@ -1,5 +1,8 @@ # This module exports classes for the various canvas item types +# NOTE: This module was an experiment and is now obsolete. +# It's best to use the Tkinter.Canvas class directly. + from Tkinter import Canvas, _cnfmerge, _flatten @@ -41,10 +44,10 @@ class CanvasItem: def bbox(self): x1, y1, x2, y2 = self.canvas.bbox(self.id) 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 bind(self, sequence=None, command=None, add=None): + return self.canvas.tag_bind(self.id, sequence, command, add) + def unbind(self, sequence, funcid=None): + self.canvas.tag_unbind(self.id, sequence, funcid) def config(self, cnf={}, **kw): return self.canvas.itemconfig(self.id, _cnfmerge((cnf, kw))) def coords(self, pts = ()): @@ -66,11 +69,11 @@ class CanvasItem: def insert(self, beforethis, string): self.canvas.insert(self.id, beforethis, string) def lower(self, belowthis=None): - self.canvas.lower(self.id, belowthis) + self.canvas.tag_lower(self.id, belowthis) def move(self, xamount, yamount): self.canvas.move(self.id, xamount, yamount) def tkraise(self, abovethis=None): - self.canvas.tkraise(self.id, abovethis) + self.canvas.tag_raise(self.id, abovethis) raise_ = tkraise # BW compat def scale(self, xorigin, yorigin, xscale, yscale): self.canvas.scale(self.id, xorigin, yorigin, xscale, yscale) @@ -142,10 +145,10 @@ class Group: self._do('addtag', 'withtag', tagOrId) def bbox(self): return self.canvas._getints(self._do('bbox')) - 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 bind(self, sequence=None, command=None, add=None): + return self.canvas.tag_bind(self.id, sequence, command, add) + def unbind(self, sequence, funcid=None): + self.canvas.tag_unbind(self.id, sequence, funcid) def coords(self, *pts): return self._do('coords', pts) def dchars(self, first, last=None): @@ -167,11 +170,11 @@ class Group: def config(self, cnf={}, **kw): return self.canvas.itemconfigure(self.tag, _cnfmerge((cnf,kw))) def lower(self, belowThis=None): - self._do('lower', belowThis) + self._do('tag_lower', belowThis) def move(self, xAmount, yAmount): self._do('move', xAmount, yAmount) def tkraise(self, aboveThis=None): - self._do('raise', aboveThis) + self._do('tag_raise', aboveThis) lift = tkraise def scale(self, xOrigin, yOrigin, xScale, yScale): self._do('scale', xOrigin, yOrigin, xScale, yScale) |