This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients epaine, felixonmars, serhiy.storchaka, terry.reedy, vstinner
Date 2021-10-15.15:08:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In Paine's failing color test, the returned tuple is The returned tuple is (0x4a48, 0x3c27, 0x8c91) versus (0x4a4a, 0x3c3c, 0x8c91), which is to say, nearly correct.  Since the tested call is 
  self._getints('winfo', 'rgb', self._w, color))
either ._getints is buggy on this particular system (seems very unlikely), or is doing something flakey on this particular system (ditto), or the result is entirely the responsibility of tcl/tk and the test is too severe, testing tk, not our _tkinter/tkinter.

The preceding assert, which passed, is
  self.assertEqual(rgb('#F0F'), (0xFFFF, 0x0000, 0xFFFF))
Since the should that the call basically works, is the more detailed test needed for testing tkinter?

I looked at the color man page.  It says "When fewer than 16 bits are provided for each color, they represent the most significant bits of the color, while the lower unfilled bits will be repeatedly replicated from the available higher bits. For example, #3a7 is the same as #3333aaaa7777." This is 4 bits to 16. It does not give an example for 8 or 12 to 16 and this might allow some wiggle room.

Other text indicates some fuzziness in exact colors. "Tk_AllocColorFromObj returns a pointer to an XColor structure; the structure indicates the exact intensities of the allocated color (which may differ slightly from those requested, depending on the limitations of the screen)"  Perhaps this screen-specific behavior is happening here. 

Also, "They allow colors to be shared whenever possible, so that colormap space is preserved, and they pick closest available colors when colormap space is exhausted. "  Could this happen here?

test_winfo_rgb has multiple asserts.  If this one is commented out, do the rest pass?
Date User Action Args
2021-10-15 15:08:59terry.reedysetrecipients: + terry.reedy, vstinner, serhiy.storchaka, felixonmars, epaine
2021-10-15 15:08:59terry.reedysetmessageid: <>
2021-10-15 15:08:59terry.reedylinkissue43139 messages
2021-10-15 15:08:59terry.reedycreate