MCPcopy Index your code
hub / github.com/python/cpython / _fixresult

Method _fixresult

Lib/tkinter/colorchooser.py:48–62  ·  view source on GitHub ↗

Adjust result returned from call to tk_chooseColor. Return both an RGB tuple of ints in the range (0, 255) and the tk color string in the form #rrggbb.

(self, widget, result)

Source from the content-addressed store, hash-verified

46 pass
47
48 def _fixresult(self, widget, result):
49 """Adjust result returned from call to tk_chooseColor.
50
51 Return both an RGB tuple of ints in the range (0, 255) and the
52 tk color string in the form #rrggbb.
53 """
54 # Result can be many things: an empty tuple, an empty string, or
55 # a _tkinter.Tcl_Obj, so this somewhat weird check handles that.
56 if not result or not str(result):
57 return None, None # canceled
58
59 # To simplify application code, the color chooser returns
60 # an RGB tuple together with the Tk color string.
61 r, g, b = widget.winfo_rgb(result)
62 return (r//256, g//256, b//256), str(result)
63
64
65#

Callers

nothing calls this directly

Calls 2

strFunction · 0.85
winfo_rgbMethod · 0.80

Tested by

no test coverage detected