diff options
author | Zackery Spytz <zspytz@gmail.com> | 2019-04-05 10:17:13 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2019-04-05 10:17:13 (GMT) |
commit | 50866e9ed3e4e0ebb60c20c3483a8df424c02722 (patch) | |
tree | 7a5e6d23b48aaed2a202df3911c3ff0b14f3a8aa /Lib/tkinter/__init__.py | |
parent | f66e336f455b5a6bb0ca857d61c43be410d0df13 (diff) | |
download | cpython-50866e9ed3e4e0ebb60c20c3483a8df424c02722.zip cpython-50866e9ed3e4e0ebb60c20c3483a8df424c02722.tar.gz cpython-50866e9ed3e4e0ebb60c20c3483a8df424c02722.tar.bz2 |
bpo-25451: Add transparency methods to tkinter.PhotoImage. (GH-10406)
Diffstat (limited to 'Lib/tkinter/__init__.py')
-rw-r--r-- | Lib/tkinter/__init__.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py index ae493ed..57d5b25 100644 --- a/Lib/tkinter/__init__.py +++ b/Lib/tkinter/__init__.py @@ -4124,6 +4124,15 @@ class PhotoImage(Image): args = args + ('-from',) + tuple(from_coords) self.tk.call(args) + def transparency_get(self, x, y): + """Return True if the pixel at x,y is transparent.""" + return self.tk.getboolean(self.tk.call( + self.name, 'transparency', 'get', x, y)) + + def transparency_set(self, x, y, boolean): + """Set the transparency of the pixel at x,y.""" + self.tk.call(self.name, 'transparency', 'set', x, y, boolean) + class BitmapImage(Image): """Widget which can display images in XBM format.""" |