Hey,
I'm just starting with Python and it may be a foolish question but here we go.
I'm using this:
to create a thread, so I can get a button that changes the text every second indicating that safety will still be on track for another lap (just like F1 Safety Car lights). The problem is, when I use CTRL + C on Putty, it just won't stop the thread, I have tried things like try/catch but no success. Have you got any idea for this? It's important for now to stop the thread when I press CTRL + C because I'm still developing so I change stuff all the time.
EDIT: Posting the function so there may be something wrong with it, also.
PS: No need to call global YellowFlags as it has been called already before I start the thread.
I'm just starting with Python and it may be a foolish question but here we go.
I'm using this:
threading.Thread(target=yellowflag).start()
to create a thread, so I can get a button that changes the text every second indicating that safety will still be on track for another lap (just like F1 Safety Car lights). The problem is, when I use CTRL + C on Putty, it just won't stop the thread, I have tried things like try/catch but no success. Have you got any idea for this? It's important for now to stop the thread when I press CTRL + C because I'm still developing so I change stuff all the time.
EDIT: Posting the function so there may be something wrong with it, also.
YellowFlag = 0
def yellowflag():
flashing = 0
while(YellowFlag):
if(flashing == 0):
texto = chr(46) + ' ' + chr(46)
remover_botao(255, 0)
insim.send(pyinsim.ISP_BTN, ReqI=255, UCID=255, ClickID=0, BStyle=32+1, L=90, T=25, W=20, H=10, Text=texto)
flashing = 1
sleep(1)
else:
texto = chr(46) + ' ' + chr(46) + ' ' + chr(46)
remover_botao(255, 0)
insim.send(pyinsim.ISP_BTN, ReqI=255, UCID=255, ClickID=0, BStyle=32+1, L=90, T=25, W=20, H=10, Text=texto)
flashing = 0
sleep(1)
PS: No need to call global YellowFlags as it has been called already before I start the thread.