diff options
author | Guido van Rossum <guido@python.org> | 1996-05-28 23:15:20 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1996-05-28 23:15:20 (GMT) |
commit | 72e316428fe4603cdafa91c3d215ade87bf3c4b7 (patch) | |
tree | 0c44a8b7c7ba69c3b880362e1fd0d6950e4363ea /Lib/tkinter | |
parent | 0978f993e3a21845e8890f7d69fcac79e1913287 (diff) | |
download | cpython-72e316428fe4603cdafa91c3d215ade87bf3c4b7.zip cpython-72e316428fe4603cdafa91c3d215ade87bf3c4b7.tar.gz cpython-72e316428fe4603cdafa91c3d215ade87bf3c4b7.tar.bz2 |
made it work again with changed Tkinter
Diffstat (limited to 'Lib/tkinter')
-rwxr-xr-x | Lib/tkinter/Canvas.py | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/Lib/tkinter/Canvas.py b/Lib/tkinter/Canvas.py index 4d278ca..1e4a5c8 100755 --- a/Lib/tkinter/Canvas.py +++ b/Lib/tkinter/Canvas.py @@ -1,10 +1,19 @@ # This module exports classes for the various canvas item types -from Tkinter import Canvas, _flatten +from Tkinter import Canvas StringType = type('') DictionaryType = type({}) +def _flatten(tuple): + res = () + for item in tuple: + if type(item) in (TupleType, ListType): + res = res + _flatten(item) + elif item is not None: + res = res + (item,) + return res + class CanvasItem: def __init__(self, canvas, itemType, *args, **kw): self.canvas = canvas @@ -25,7 +34,7 @@ class CanvasItem: self.id, '-' + key)) return v[4] def __setitem__(self, key, value): - self.canvas._itemconfig(self.id, {key: value}) + self.canvas.itemconfig(self.id, {key: value}) def keys(self): if not hasattr(self, '_keys'): self._keys = map(lambda x, tk=self.canvas.tk: @@ -34,7 +43,7 @@ class CanvasItem: self.canvas._do( 'itemconfigure', (self.id,)))) - return self._keys + return self._keys def has_key(self, key): return key in self.keys() def addtag(self, tag, option='withtag'): @@ -68,8 +77,9 @@ class CanvasItem: self.canvas.lower(self.id, belowthis) def move(self, xamount, yamount): self.canvas.move(self.id, xamount, yamount) - def raise_(self, abovethis=None): - self.canvas.raise_(self.id, abovethis) + def tkraise(self, abovethis=None): + self.canvas.tkraise(self.id, abovethis) + raise_ = tkraise # BW compat def scale(self, xorigin, yorigin, xscale, yscale): self.canvas.scale(self.id, xorigin, yorigin, xscale, yscale) def type(self): @@ -83,6 +93,10 @@ class Bitmap(CanvasItem): def __init__(self, canvas, *args): CanvasItem.__init__(self, canvas, 'bitmap', args) +class ImageItem(CanvasItem): + def __init__(self, canvas, *args): + CanvasItem.__init__(self, canvas, 'image', args) + class Line(CanvasItem): def __init__(self, canvas, *args): CanvasItem.__init__(self, canvas, 'line', args) |