[Python-checkins] cpython (3.4): Modernize turtledemo with conditional expressions; remove duplicate line.

terry.reedy python-checkins at python.org
Sun Jul 27 09:01:54 CEST 2014


http://hg.python.org/cpython/rev/024d5655a20b
changeset:   91893:024d5655a20b
branch:      3.4
parent:      91890:d0570cba3749
user:        Terry Jan Reedy <tjreedy at udel.edu>
date:        Sun Jul 27 03:01:13 2014 -0400
summary:
  Modernize turtledemo with conditional expressions; remove duplicate line.

files:
  Lib/turtledemo/__main__.py |  25 ++++++-------------------
  1 files changed, 6 insertions(+), 19 deletions(-)


diff --git a/Lib/turtledemo/__main__.py b/Lib/turtledemo/__main__.py
--- a/Lib/turtledemo/__main__.py
+++ b/Lib/turtledemo/__main__.py
@@ -127,25 +127,12 @@
     def configGUI(self, menu, start, stop, clear, txt="", color="blue"):
         self.ExamplesBtn.config(state=menu)
 
-        self.start_btn.config(state=start)
-        if start == NORMAL:
-            self.start_btn.config(bg="#d00")
-        else:
-            self.start_btn.config(bg="#fca")
-
-        self.stop_btn.config(state=stop)
-        if stop == NORMAL:
-            self.stop_btn.config(bg="#d00")
-        else:
-            self.stop_btn.config(bg="#fca")
-        self.clear_btn.config(state=clear)
-
-        self.clear_btn.config(state=clear)
-        if clear == NORMAL:
-            self.clear_btn.config(bg="#d00")
-        else:
-            self.clear_btn.config(bg="#fca")
-
+        self.start_btn.config(state=start,
+                              bg="#d00" if start == NORMAL else "#fca")
+        self.stop_btn.config(state=stop,
+                             bg="#d00" if stop == NORMAL else "#fca")
+        self.clear_btn.config(state=clear,
+                              bg="#d00" if clear == NORMAL else"#fca")
         self.output_lbl.config(text=txt, fg=color)
 
     def makeLoadDemoMenu(self):

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list