summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-08-07 14:55:21 (GMT)
committerGuido van Rossum <guido@python.org>1998-08-07 14:55:21 (GMT)
commit5ff1761d3ffb5eeefab46ad3052739a07e902d6f (patch)
tree024d3c6df81cc2ead502b1b50964e24fce2c1b0e
parenta42c1ee21df701d434ee0857ed5ce1adba5e1acf (diff)
downloadcpython-5ff1761d3ffb5eeefab46ad3052739a07e902d6f.zip
cpython-5ff1761d3ffb5eeefab46ad3052739a07e902d6f.tar.gz
cpython-5ff1761d3ffb5eeefab46ad3052739a07e902d6f.tar.bz2
From: "Fredrik Lundh" <fredrik@pythonware.com>
Date: Fri, 7 Aug 1998 13:37:12 +0100 the "initialcolor" code is broken in several places in the current version of tkColorChooser. I've attached an up- dated version for 1.5.2.
-rw-r--r--Lib/lib-tk/tkColorChooser.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/Lib/lib-tk/tkColorChooser.py b/Lib/lib-tk/tkColorChooser.py
index a3db41e..36df25b 100644
--- a/Lib/lib-tk/tkColorChooser.py
+++ b/Lib/lib-tk/tkColorChooser.py
@@ -9,6 +9,8 @@
#
# written by Fredrik Lundh, May 1997
#
+# fixed initialcolor handling in August 1998
+#
#
# options (all have default values):
@@ -21,10 +23,6 @@
# - title: dialog title
#
-# FIXME: as of Tk 8.0a2, the Unix colour picker is really ugly, and
-# doesn't seem to work properly on true colour displays. maybe we
-# should use the instant python version instead?
-
from tkCommonDialog import Dialog
@@ -42,7 +40,7 @@ class Chooser(Dialog):
color = self.options["initialcolor"]
if type(color) == type(()):
# assume an RGB triplet
- self.options["initialcolor"] = "%02x%02x%02x" % color
+ self.options["initialcolor"] = "#%02x%02x%02x" % color
except KeyError:
pass
@@ -61,6 +59,10 @@ class Chooser(Dialog):
def askcolor(color = None, **options):
"Ask for a color"
+ if color:
+ options = options.copy()
+ options["initialcolor"] = color
+
return apply(Chooser, (), options).show()