it is displayed as transparent and the background of whatever window it
is displayed in shows through.
+ .. method:: redither()
+
+ Recalculate the dithered image in each window where it is displayed.
+ This is useful when the image data was supplied in pieces, in which case
+ the dithered image may not be exactly correct.
+
+ .. versionadded:: next
+
.. method:: cget(option)
Return the current value of the configuration option *option*.
badge) and :meth:`~tkinter.Wm.wm_stackorder` (toplevel stacking order).
(Contributed by Serhiy Storchaka in :gh:`151874`.)
+* Added the :meth:`~tkinter.PhotoImage.redither` method which recalculates the
+ dithered image when its data was supplied in pieces.
+ (Contributed by Serhiy Storchaka in :gh:`151888`.)
+
+
xml
---
self.assertEqual(image.height(), 16)
self.assertEqual(image.get(4, 6), self.colorlist(0, 0, 0))
+ def test_redither(self):
+ image = self.create()
+ pixel = image.get(4, 6)
+ image.redither() # Recalculates the dithering; the data is unchanged.
+ self.assertEqual(image.get(4, 6), pixel)
+
def test_copy(self):
image = self.create()
image2 = image.copy()
"""Display a transparent image."""
self.tk.call(self.name, 'blank')
+ def redither(self):
+ """Recalculate the dithered image in each window where it is displayed.
+
+ Useful when the image data was supplied in pieces, in which case the
+ dithered image may not be exactly correct."""
+ self.tk.call(self.name, 'redither')
+
def cget(self, option):
"""Return the value of OPTION."""
return self.tk.call(self.name, 'cget', '-' + option)
--- /dev/null
+Add the :meth:`!tkinter.PhotoImage.redither` method, wrapping the photo image
+``redither`` Tk command.