Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8b95d5e

Browse files
committed
Modernize turtledemo with conditional expressions; remove duplicate line.
1 parent e3416e6 commit 8b95d5e

1 file changed

Lines changed: 6 additions & 19 deletions

File tree

Lib/turtledemo/__main__.py

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -127,25 +127,12 @@ def makeGraphFrame(self, root):
127127
def configGUI(self, menu, start, stop, clear, txt="", color="blue"):
128128
self.ExamplesBtn.config(state=menu)
129129

130-
self.start_btn.config(state=start)
131-
if start == NORMAL:
132-
self.start_btn.config(bg="#d00")
133-
else:
134-
self.start_btn.config(bg="#fca")
135-
136-
self.stop_btn.config(state=stop)
137-
if stop == NORMAL:
138-
self.stop_btn.config(bg="#d00")
139-
else:
140-
self.stop_btn.config(bg="#fca")
141-
self.clear_btn.config(state=clear)
142-
143-
self.clear_btn.config(state=clear)
144-
if clear == NORMAL:
145-
self.clear_btn.config(bg="#d00")
146-
else:
147-
self.clear_btn.config(bg="#fca")
148-
130+
self.start_btn.config(state=start,
131+
bg="#d00" if start == NORMAL else "#fca")
132+
self.stop_btn.config(state=stop,
133+
bg="#d00" if stop == NORMAL else "#fca")
134+
self.clear_btn.config(state=clear,
135+
bg="#d00" if clear == NORMAL else"#fca")
149136
self.output_lbl.config(text=txt, fg=color)
150137

151138
def makeLoadDemoMenu(self):

0 commit comments

Comments
 (0)