[Python-checkins] r68013 - in python/branches/release30-maint: Lib/tkinter/colorchooser.py Misc/NEWS

martin.v.loewis python-checkins at python.org
Mon Dec 29 17:28:12 CET 2008


Author: martin.v.loewis
Date: Mon Dec 29 17:28:12 2008
New Revision: 68013
Log:
Merged revisions 68012 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/branches/py3k
................
 r68012 | martin.v.loewis | 2008年12月29日 17:27:13 +0100 (Mo, 29 Dez 2008) | 9 lines
 
 Merged revisions 68010 via svnmerge from 
 svn+ssh://pythondev@svn.python.org/python/trunk
 
 ........
 r68010 | martin.v.loewis | 2008年12月29日 17:22:25 +0100 (Mo, 29 Dez 2008) | 2 lines
 
 Issue #3767: Convert Tk object to string in tkColorChooser.
 ........
................
Modified:
 python/branches/release30-maint/ (props changed)
 python/branches/release30-maint/Lib/tkinter/colorchooser.py
 python/branches/release30-maint/Misc/NEWS
Modified: python/branches/release30-maint/Lib/tkinter/colorchooser.py
==============================================================================
--- python/branches/release30-maint/Lib/tkinter/colorchooser.py	(original)
+++ python/branches/release30-maint/Lib/tkinter/colorchooser.py	Mon Dec 29 17:28:12 2008
@@ -34,19 +34,22 @@
 try:
 # make sure initialcolor is a tk color string
 color = self.options["initialcolor"]
- if type(color) == type(()):
+ if isinstance(color, tuple):
 # assume an RGB triplet
 self.options["initialcolor"] = "#%02x%02x%02x" % color
 except KeyError:
 pass
 
 def _fixresult(self, widget, result):
+ # result can be somethings: an empty tuple, an empty string or
+ # a Tcl_Obj, so this somewhat weird check handles that
+ if not result or not str(result):
+ return None, None # canceled
+
 # to simplify application code, the color chooser returns
 # an RGB tuple together with the Tk color string
- if not result:
- return None, None # canceled
 r, g, b = widget.winfo_rgb(result)
- return (r/256, g/256, b/256), result
+ return (r/256, g/256, b/256), str(result)
 
 
 #
@@ -66,5 +69,4 @@
 # test stuff
 
 if __name__ == "__main__":
-
 print("color", askcolor())
Modified: python/branches/release30-maint/Misc/NEWS
==============================================================================
--- python/branches/release30-maint/Misc/NEWS	(original)
+++ python/branches/release30-maint/Misc/NEWS	Mon Dec 29 17:28:12 2008
@@ -42,6 +42,8 @@
 Library
 -------
 
+- Issue #3767: Convert Tk object to string in tkColorChooser.
+
 - Issue #3248: Allow placing ScrolledText in a PanedWindow.
 
 - Issue #4574: reading an UTF16-encoded text file crashes if \r on 64-char


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /