summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-09-06 21:09:31 (GMT)
committerGuido van Rossum <guido@python.org>1996-09-06 21:09:31 (GMT)
commit5c1d1ee8a8a77cfb6f7226a5d0123244ddfd84a3 (patch)
tree9356b860dfb32cb0366e41d5206d40db73f603d8
parent8130054c815025bc4605f5081ad0ee185345eed0 (diff)
downloadcpython-5c1d1ee8a8a77cfb6f7226a5d0123244ddfd84a3.zip
cpython-5c1d1ee8a8a77cfb6f7226a5d0123244ddfd84a3.tar.gz
cpython-5c1d1ee8a8a77cfb6f7226a5d0123244ddfd84a3.tar.bz2
Change to allow keyword args for Group,
suggested by Nils Fischbeck, adapted by Fred
-rw-r--r--Lib/lib-tk/Canvas.py11
-rwxr-xr-xLib/tkinter/Canvas.py11
2 files changed, 12 insertions, 10 deletions
diff --git a/Lib/lib-tk/Canvas.py b/Lib/lib-tk/Canvas.py
index 4fdc578..801fd8b 100644
--- a/Lib/lib-tk/Canvas.py
+++ b/Lib/lib-tk/Canvas.py
@@ -1,6 +1,6 @@
# This module exports classes for the various canvas item types
-from Tkinter import Canvas, _flatten
+from Tkinter import Canvas, _cnfmerge, _flatten
class CanvasItem:
@@ -42,8 +42,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 config(self, cnf=None):
- return self.canvas.itemconfig(self.id, cnf)
+ def config(self, cnf={}, **kw):
+ return self.canvas.itemconfig(self.id, _cnfmerge((cnf, kw)))
def coords(self, pts = ()):
flat = ()
for x, y in pts: flat = flat + (x, y)
@@ -120,6 +120,7 @@ class Group:
self.canvas.dtag(self.tag)
def str(self):
return self.tag
+ __str__ = str
def _do(self, cmd, *args):
return self.canvas._do(cmd, (self.tag,) + _flatten(args))
def addtag_above(self, tagOrId):
@@ -158,8 +159,8 @@ class Group:
return self.canvas.tk.getint(self._do('index', index))
def insert(self, beforeThis, string):
self._do('insert', beforeThis, string)
- def config(self, cnf=None):
- return self.canvas.itemconfigure(self.tag, cnf)
+ def config(self, cnf={}, **kw):
+ return self.canvas.itemconfigure(self.tag, _cnfmerge((cnf,kw)))
def lower(self, belowThis=None):
self._do('lower', belowThis)
def move(self, xAmount, yAmount):
diff --git a/Lib/tkinter/Canvas.py b/Lib/tkinter/Canvas.py
index 4fdc578..801fd8b 100755
--- a/Lib/tkinter/Canvas.py
+++ b/Lib/tkinter/Canvas.py
@@ -1,6 +1,6 @@
# This module exports classes for the various canvas item types
-from Tkinter import Canvas, _flatten
+from Tkinter import Canvas, _cnfmerge, _flatten
class CanvasItem:
@@ -42,8 +42,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 config(self, cnf=None):
- return self.canvas.itemconfig(self.id, cnf)
+ def config(self, cnf={}, **kw):
+ return self.canvas.itemconfig(self.id, _cnfmerge((cnf, kw)))
def coords(self, pts = ()):
flat = ()
for x, y in pts: flat = flat + (x, y)
@@ -120,6 +120,7 @@ class Group:
self.canvas.dtag(self.tag)
def str(self):
return self.tag
+ __str__ = str
def _do(self, cmd, *args):
return self.canvas._do(cmd, (self.tag,) + _flatten(args))
def addtag_above(self, tagOrId):
@@ -158,8 +159,8 @@ class Group:
return self.canvas.tk.getint(self._do('index', index))
def insert(self, beforeThis, string):
self._do('insert', beforeThis, string)
- def config(self, cnf=None):
- return self.canvas.itemconfigure(self.tag, cnf)
+ def config(self, cnf={}, **kw):
+ return self.canvas.itemconfigure(self.tag, _cnfmerge((cnf,kw)))
def lower(self, belowThis=None):
self._do('lower', belowThis)
def move(self, xAmount, yAmount):