summaryrefslogtreecommitdiffstats
path: root/Tools/pynche
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>1998-02-11 18:56:13 (GMT)
committerBarry Warsaw <barry@python.org>1998-02-11 18:56:13 (GMT)
commiteab81a92477011eb9c5f13c80fa3dd5d049a6578 (patch)
tree9424ac52cb19820ed884bd3a31d3b8e838a022c7 /Tools/pynche
parent55d3ffa3c205a4157f7f6f356a2a25b5c034e33a (diff)
downloadcpython-eab81a92477011eb9c5f13c80fa3dd5d049a6578.zip
cpython-eab81a92477011eb9c5f13c80fa3dd5d049a6578.tar.gz
cpython-eab81a92477011eb9c5f13c80fa3dd5d049a6578.tar.bz2
Better conversion of command line given initial color
Diffstat (limited to 'Tools/pynche')
-rw-r--r--Tools/pynche/Main.py21
1 files changed, 18 insertions, 3 deletions
diff --git a/Tools/pynche/Main.py b/Tools/pynche/Main.py
index 3eeccbf..1007838 100644
--- a/Tools/pynche/Main.py
+++ b/Tools/pynche/Main.py
@@ -14,9 +14,13 @@ This program currently requires Python 1.5 with Tkinter. It also requires at
least Pmw 0.6.1. It has only been tested on Solaris 2.6. Feedback is greatly
appreciated. Send email to bwarsaw@python.org
-Usage: %(PROGRAM)s [-h]
+Usage: %(PROGRAM)s [-c color] [-h]
Where:
+ --color color
+ -c color
+ initial color, as an X color name or #RRGGBB format
+
--help
-h
print this message
@@ -71,7 +75,7 @@ def keepalive():
def main():
global app
- initialcolor = 'grey50'
+ initialcolor = (128, 128, 128)
try:
opts, args = getopt.getopt(sys.argv[1:],
'hc:',
@@ -101,7 +105,18 @@ def main():
app = Pmw.initialise(fontScheme='pmw1')
app.title('Pynche %s' % __version__)
app.tk.createtimerhandler(KEEPALIVE_TIMER, keepalive)
- p = PyncheWidget(colordb, app, color=initialcolor)
+
+ # get triplet for initial color
+ try:
+ red, green, blue = colordb.find_byname(initialcolor)
+ except ColorDB.BadColor:
+ # must be a #rrggbb style color
+ try:
+ red, green, blue = ColorDB.rrggbb_to_triplet(initialcolor)
+ except ColorDB.BadColor:
+ usage(1, 'Bad initial color: %s' % initialcolor)
+
+ p = PyncheWidget(colordb, app, color=(red, green, blue))
try:
keepalive()
app.mainloop()