summaryrefslogtreecommitdiffstats
path: root/Lib/tkinter/__init__.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-08-24 06:10:58 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2014-08-24 06:10:58 (GMT)
commit66106626edb739f7d5dd3d0a7a2dd634a0e5a0b8 (patch)
treebc5490fca9f1c1b35565d445ccf6da176b558d01 /Lib/tkinter/__init__.py
parentfa6e73bac93957136d0e41e3f09572995d95f4cc (diff)
parentd00aff2f62481c3e8cf3b8e9cbbaf888361ffdd4 (diff)
downloadcpython-66106626edb739f7d5dd3d0a7a2dd634a0e5a0b8.zip
cpython-66106626edb739f7d5dd3d0a7a2dd634a0e5a0b8.tar.gz
cpython-66106626edb739f7d5dd3d0a7a2dd634a0e5a0b8.tar.bz2
Issue #22236: Tkinter tests now don't reuse default root window. New root
window is created for every test class. Fixed Tkinter images copying operations in NoDefaultRoot mode. Tcl command names generated for "after" callbacks now contains a name of original function.
Diffstat (limited to 'Lib/tkinter/__init__.py')
-rw-r--r--Lib/tkinter/__init__.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py
index 2c64971..51f5077 100644
--- a/Lib/tkinter/__init__.py
+++ b/Lib/tkinter/__init__.py
@@ -562,6 +562,7 @@ class Misc:
self.deletecommand(name)
except TclError:
pass
+ callit.__name__ = func.__name__
name = self._register(callit)
return self.tk.call('after', ms, name)
def after_idle(self, func, *args):
@@ -3314,7 +3315,7 @@ class Image:
master = _default_root
if not master:
raise RuntimeError('Too early to create image')
- self.tk = master.tk
+ self.tk = getattr(master, 'tk', master)
if not name:
Image._last_id += 1
name = "pyimage%r" % (Image._last_id,) # tk itself would use image<x>
@@ -3385,20 +3386,20 @@ class PhotoImage(Image):
# XXX copy -from, -to, ...?
def copy(self):
"""Return a new PhotoImage with the same image as this widget."""
- destImage = PhotoImage()
+ destImage = PhotoImage(master=self.tk)
self.tk.call(destImage, 'copy', self.name)
return destImage
def zoom(self,x,y=''):
"""Return a new PhotoImage with the same image as this widget
but zoom it with X and Y."""
- destImage = PhotoImage()
+ destImage = PhotoImage(master=self.tk)
if y=='': y=x
self.tk.call(destImage, 'copy', self.name, '-zoom',x,y)
return destImage
def subsample(self,x,y=''):
"""Return a new PhotoImage based on the same image as this widget
but use only every Xth or Yth pixel."""
- destImage = PhotoImage()
+ destImage = PhotoImage(master=self.tk)
if y=='': y=x
self.tk.call(destImage, 'copy', self.name, '-subsample',x,y)
return destImage