thread buxfix, attempt #1

This commit is contained in:
interfisch 2017-02-18 19:56:48 +01:00
parent 049efaa26f
commit c2804d8ac1
2 changed files with 5 additions and 3 deletions

View File

@ -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)

View File

@ -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