From c2804d8ac183832a0907886abc2be719a40cdca4 Mon Sep 17 00:00:00 2001 From: Philipp Date: Sat, 18 Feb 2017 19:56:48 +0100 Subject: [PATCH] thread buxfix, attempt #1 --- FlipdotSender.py | 6 +++--- hangman.py | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/FlipdotSender.py b/FlipdotSender.py index d85cbd8..51ae798 100644 --- a/FlipdotSender.py +++ b/FlipdotSender.py @@ -106,11 +106,12 @@ class FlipdotSender(object): packet = self._array2packet(imgmaptmp) self._sock.sendto(bytes(packet), (self._udphost, self._udpport)) time.sleep(0.2) - if threadrunning==True: #if animation wasnt cancelled + if threadrunning==True: #if animation hasnt been cancelled self.sendPacket(imgmap) #send packet and save last-imagemap threadrunning=False else: self.sendPacket(imgmap) #send packet and save last-imagemap + def sendPacket(self, imgmap): packet = self._array2packet(imgmap) @@ -176,8 +177,7 @@ class FlipdotSender(object): else: draw.text((0,-1), text[0:splitpoint], font=font, fill=FlipdotSender.C_WHITE) draw.text((0,-1+currentfontsize), text[splitpoint:], font=font, fill=FlipdotSender.C_WHITE) - - + self._send(image,fadespeed) diff --git a/hangman.py b/hangman.py index 8c34fd7..50306df 100644 --- a/hangman.py +++ b/hangman.py @@ -49,12 +49,14 @@ class Hangman(object): #self._wordlist="/home/pi/mqtt-to-flipdot/hangman/wordlists/nomenliste_de.txt" #self._wordlist="/home/pi/mqtt-to-flipdot/hangman/wordlists/crodict_nomen.txt" self._wordlist="/home/pi/mqtt-to-flipdot/hangman/wordlists/nerdwords.txt" + #self._wordlist="./hangman/wordlists/nerdwords.txt" #<- use for local testing self._gamestate=0# 0=start 1=ingame 2=lose 3=win self._g_word="test" #word self._g_displword="" #display word self._g_chars="" #used characters self._hmdir="/home/pi/mqtt-to-flipdot/hangman/stdhm/" + #self._hmdir="./hangman/stdhm/" #<- use for local testing self._hmimg=[] self._maxfails=len( os.listdir(self._hmdir))-1 -1 #maxfails defined by files in directory, -1 -1 because win image