[Python-checkins] cpython (2.7): Modernize turtledemo with conditional expressions; remove duplicate line.
terry.reedy
python-checkins at python.org
Sun Jul 27 09:01:53 CEST 2014
http://hg.python.org/cpython/rev/f279fb48c60a
changeset: 91892:f279fb48c60a
branch: 2.7
parent: 91881:04c916a1e82f
user: Terry Jan Reedy <tjreedy at udel.edu>
date: Sun Jul 27 03:00:47 2014 -0400
summary:
Modernize turtledemo with conditional expressions; remove duplicate line.
files:
Demo/turtle/turtleDemo.py | 25 ++++++-------------------
1 files changed, 6 insertions(+), 19 deletions(-)
diff --git a/Demo/turtle/turtleDemo.py b/Demo/turtle/turtleDemo.py
--- a/Demo/turtle/turtleDemo.py
+++ b/Demo/turtle/turtleDemo.py
@@ -144,25 +144,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