From f59346f307cb1ae24d8e1348124de7a3fbea8960 Mon Sep 17 00:00:00 2001 From: Fisch Date: Thu, 26 Oct 2017 23:51:09 +0200 Subject: [PATCH] fix hangman error if display string empty --- hangman.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hangman.py b/hangman.py index 4130aec..78cf204 100644 --- a/hangman.py +++ b/hangman.py @@ -262,9 +262,10 @@ class Hangman(object): #for i in range(0,len(s2)): # draw.text((fo_word2[0]+i*5, fo_word2[1]), s2[i], font=font, fill=C_TEXT) - - draw.text(self._fo_word, s1.upper(), font=font, fill=C_TEXT) - draw.text(self._fo_word2, s2.upper(), font=font, fill=C_TEXT) + if (len(s1)>0): + draw.text(self._fo_word, s1.upper(), font=font, fill=C_TEXT) + if (len(s2)>0): + draw.text(self._fo_word2, s2.upper(), font=font, fill=C_TEXT) def _drawLoseScreen(self,draw): self._drawGameScreen(draw)