Skip to content

Commit 3c9bbff

Browse files
committed
TR updates, first round
1 parent 9f1ca9d commit 3c9bbff

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

hangman-pysimplegui/source_code_final/hangman.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def _draw_hanged_man(self):
168168
self._canvas.DrawLine(*part, color="red", width=2)
169169

170170
def _select_word(self):
171-
with open("words.txt", mode="r") as words:
171+
with open("words.txt", mode="r", encoding="utf-8") as words:
172172
word_list = words.readlines()
173173
return choice(word_list).strip().upper()
174174

@@ -208,7 +208,7 @@ def _play(self, letter):
208208

209209
def read_event(self):
210210
event = self._window.read()
211-
event_id = event[0] if event is not None else event
211+
event_id = event[0] if event is not None else None
212212
return event_id
213213

214214
def process_event(self, event):

hangman-pysimplegui/source_code_step_5/hangman.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def _draw_hanged_man(self):
165165
self._canvas.DrawLine(*part, color="red", width=2)
166166

167167
def _select_word(self):
168-
with open("words.txt", mode="r") as words:
168+
with open("words.txt", mode="r", encoding="utf-8") as words:
169169
word_list = words.readlines()
170170
return choice(word_list).strip().upper()
171171

hangman-pysimplegui/source_code_step_6/hangman.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def _draw_hanged_man(self):
168168
self._canvas.DrawLine(*part, color="red", width=2)
169169

170170
def _select_word(self):
171-
with open("words.txt", mode="r") as words:
171+
with open("words.txt", mode="r", encoding="utf-8") as words:
172172
word_list = words.readlines()
173173
return choice(word_list).strip().upper()
174174

@@ -208,7 +208,7 @@ def _play(self, letter):
208208

209209
def read_event(self):
210210
event = self._window.read()
211-
event_id = event[0] if event is not None else event
211+
event_id = event[0] if event is not None else None
212212
return event_id
213213

214214
def process_event(self, event):

0 commit comments

Comments
 (0)