Skip to content

Commit

Permalink
TR updates, first round
Browse files Browse the repository at this point in the history
  • Loading branch information
lpozo committed Nov 28, 2023
1 parent 9f1ca9d commit 3c9bbff
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions hangman-pysimplegui/source_code_final/hangman.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def _draw_hanged_man(self):
self._canvas.DrawLine(*part, color="red", width=2)

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

Expand Down Expand Up @@ -208,7 +208,7 @@ def _play(self, letter):

def read_event(self):
event = self._window.read()
event_id = event[0] if event is not None else event
event_id = event[0] if event is not None else None
return event_id

def process_event(self, event):
Expand Down
2 changes: 1 addition & 1 deletion hangman-pysimplegui/source_code_step_5/hangman.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def _draw_hanged_man(self):
self._canvas.DrawLine(*part, color="red", width=2)

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

Expand Down
4 changes: 2 additions & 2 deletions hangman-pysimplegui/source_code_step_6/hangman.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def _draw_hanged_man(self):
self._canvas.DrawLine(*part, color="red", width=2)

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

Expand Down Expand Up @@ -208,7 +208,7 @@ def _play(self, letter):

def read_event(self):
event = self._window.read()
event_id = event[0] if event is not None else event
event_id = event[0] if event is not None else None
return event_id

def process_event(self, event):
Expand Down

0 comments on commit 3c9bbff

Please sign in to comment.