summaryrefslogtreecommitdiff
path: root/sys/lib/python/lib-tk/tkColorChooser.py
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2021-06-14 00:00:37 +0000
committerOri Bernstein <ori@eigenstate.org>2021-06-14 00:00:37 +0000
commita73a964e51247ed169d322c725a3a18859f109a3 (patch)
tree3f752d117274d444bda44e85609aeac1acf313f3 /sys/lib/python/lib-tk/tkColorChooser.py
parente64efe273fcb921a61bf27d33b230c4e64fcd425 (diff)
python, hg: tow outside the environment.
they've served us well, and can ride off into the sunset.
Diffstat (limited to 'sys/lib/python/lib-tk/tkColorChooser.py')
-rw-r--r--sys/lib/python/lib-tk/tkColorChooser.py70
1 files changed, 0 insertions, 70 deletions
diff --git a/sys/lib/python/lib-tk/tkColorChooser.py b/sys/lib/python/lib-tk/tkColorChooser.py
deleted file mode 100644
index a55a797dd..000000000
--- a/sys/lib/python/lib-tk/tkColorChooser.py
+++ /dev/null
@@ -1,70 +0,0 @@
-# tk common colour chooser dialogue
-#
-# this module provides an interface to the native color dialogue
-# available in Tk 4.2 and newer.
-#
-# written by Fredrik Lundh, May 1997
-#
-# fixed initialcolor handling in August 1998
-#
-
-#
-# options (all have default values):
-#
-# - initialcolor: colour to mark as selected when dialog is displayed
-# (given as an RGB triplet or a Tk color string)
-#
-# - parent: which window to place the dialog on top of
-#
-# - title: dialog title
-#
-
-from tkCommonDialog import Dialog
-
-
-#
-# color chooser class
-
-class Chooser(Dialog):
- "Ask for a color"
-
- command = "tk_chooseColor"
-
- def _fixoptions(self):
- try:
- # make sure initialcolor is a tk color string
- color = self.options["initialcolor"]
- if type(color) == type(()):
- # assume an RGB triplet
- self.options["initialcolor"] = "#%02x%02x%02x" % color
- except KeyError:
- pass
-
- def _fixresult(self, widget, result):
- # 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
-
-
-#
-# convenience stuff
-
-def askcolor(color = None, **options):
- "Ask for a color"
-
- if color:
- options = options.copy()
- options["initialcolor"] = color
-
- return Chooser(**options).show()
-
-
-# --------------------------------------------------------------------
-# test stuff
-
-if __name__ == "__main__":
-
- print "color", askcolor()