From 971651e99eab685f3cd622effc169ba6c398cea4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Delfino?= Date: Sun, 15 Apr 2018 11:14:20 -0300 Subject: [PATCH 1/4] Mention PNG as a supported format by Tcl/Tk --- Doc/library/tkinter.rst | 2 +- Lib/tkinter/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/tkinter.rst b/Doc/library/tkinter.rst index 6d90e43e33b266..f7eac24fb3d19e 100644 --- a/Doc/library/tkinter.rst +++ b/Doc/library/tkinter.rst @@ -788,7 +788,7 @@ Bitmap/Pixelmap images can be created through the subclasses of * :class:`BitmapImage` can be used for X11 bitmap data. -* :class:`PhotoImage` can be used for GIF and PPM/PGM color bitmaps. +* :class:`PhotoImage` can be used for PNG, GIF and PPM/PGM color bitmaps. Either type of image is created through either the ``file`` or the ``data`` option (other options are available as well). diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py index 53bad3fa95aecf..ee06b3f50df8b5 100644 --- a/Lib/tkinter/__init__.py +++ b/Lib/tkinter/__init__.py @@ -3533,7 +3533,7 @@ def width(self): self.tk.call('image', 'width', self.name)) class PhotoImage(Image): - """Widget which can display colored images in GIF, PPM/PGM format.""" + """Widget which can display colored images in PNG, GIF, PPM/PGM format.""" def __init__(self, name=None, cnf={}, master=None, **kw): """Create an image with NAME. From 4cb34c0b29d272830399afd407143acb058ff7e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Delfino?= Date: Sun, 15 Apr 2018 14:32:21 -0300 Subject: [PATCH 2/4] Specify which Tcl/Tk version supports PNG. Addresses msg315326, msg315330 --- Doc/library/tkinter.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/library/tkinter.rst b/Doc/library/tkinter.rst index f7eac24fb3d19e..5a1f7836954601 100644 --- a/Doc/library/tkinter.rst +++ b/Doc/library/tkinter.rst @@ -788,7 +788,8 @@ Bitmap/Pixelmap images can be created through the subclasses of * :class:`BitmapImage` can be used for X11 bitmap data. -* :class:`PhotoImage` can be used for PNG, GIF and PPM/PGM color bitmaps. +* :class:`PhotoImage` can be used for GIF and PPM/PGM bitmaps. This class can + also be used for PNG bitmaps starting with Tcl/Tk 8.6. Either type of image is created through either the ``file`` or the ``data`` option (other options are available as well). From 739a8d2988437993e1de894f9432f77c2ab0d232 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Delfino?= Date: Sun, 15 Apr 2018 18:37:44 -0300 Subject: [PATCH 3/4] Address PR comments --- Doc/library/tkinter.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Doc/library/tkinter.rst b/Doc/library/tkinter.rst index 5a1f7836954601..741eb687058eac 100644 --- a/Doc/library/tkinter.rst +++ b/Doc/library/tkinter.rst @@ -783,13 +783,13 @@ Menu indexes (menu.invoke(), menu.entryconfig(), etc.) Images ^^^^^^ -Bitmap/Pixelmap images can be created through the subclasses of -:class:`tkinter.Image`: +Images of different formats can be created through the corresponding subclass +of :class:`tkinter.Image`: -* :class:`BitmapImage` can be used for X11 bitmap data. +* :class:`BitmapImage` for images in XBM format. -* :class:`PhotoImage` can be used for GIF and PPM/PGM bitmaps. This class can - also be used for PNG bitmaps starting with Tcl/Tk 8.6. +* :class:`PhotoImage` for images in PPM, PGM, GIF and PNG formats. The latter + is supported starting with Tk 8.6. Either type of image is created through either the ``file`` or the ``data`` option (other options are available as well). From aefad5faef7d55833ecfee126dd9ccd694461a47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Delfino?= Date: Sun, 15 Apr 2018 18:44:43 -0300 Subject: [PATCH 4/4] Final polishes --- Doc/library/tkinter.rst | 2 +- Lib/tkinter/__init__.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/tkinter.rst b/Doc/library/tkinter.rst index 741eb687058eac..b99dc8ec276272 100644 --- a/Doc/library/tkinter.rst +++ b/Doc/library/tkinter.rst @@ -788,7 +788,7 @@ of :class:`tkinter.Image`: * :class:`BitmapImage` for images in XBM format. -* :class:`PhotoImage` for images in PPM, PGM, GIF and PNG formats. The latter +* :class:`PhotoImage` for images in PGM, PPM, GIF and PNG formats. The latter is supported starting with Tk 8.6. Either type of image is created through either the ``file`` or the ``data`` diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py index ee06b3f50df8b5..b78191e2777f45 100644 --- a/Lib/tkinter/__init__.py +++ b/Lib/tkinter/__init__.py @@ -3533,7 +3533,7 @@ def width(self): self.tk.call('image', 'width', self.name)) class PhotoImage(Image): - """Widget which can display colored images in PNG, GIF, PPM/PGM format.""" + """Widget which can display images in PGM, PPM, GIF, PNG format.""" def __init__(self, name=None, cnf={}, master=None, **kw): """Create an image with NAME. @@ -3597,7 +3597,7 @@ def write(self, filename, format=None, from_coords=None): self.tk.call(args) class BitmapImage(Image): - """Widget which can display a bitmap.""" + """Widget which can display images in XBM format.""" def __init__(self, name=None, cnf={}, master=None, **kw): """Create a bitmap with NAME.