Closed bennuttall closed 6 years ago
When the GUI is automatically spawned from a Python shell, any keyboard interrupt will silently kill the GUI.
To reproduce:
Open a Python shell
Import sense_emu and create a SenseHat object:
sense_emu
SenseHat
from sense_emu import SenseHat sense = SenseHat()
(A GUI will be spawned automatically)
Run a while loop, e.g:
while True: print(1)
Hit Ctrl + C to terminate the loop
Try to update the Sense Hat display:
sense.clear(255, 0, 0)
(the LEDs on the display should go red, but they don't)
Re-initialise the GUI:
sense = SenseHat()
(note the leds are now red)
Try to update the display again:
sense.clear()
(this should (and does) clear the leds)
It seems that killing the while loop also kills the GUI process spawned from the shell.
This is because signals are sent to the process group on Linux/UNIX (and Windows? Not sure). Easy enough to fix with setpgrp - I'll push something in a mo.
When the GUI is automatically spawned from a Python shell, any keyboard interrupt will silently kill the GUI.
To reproduce:
Open a Python shell
Import
sense_emu
and create aSenseHat
object:(A GUI will be spawned automatically)
Run a while loop, e.g:
Hit Ctrl + C to terminate the loop
Try to update the Sense Hat display:
(the LEDs on the display should go red, but they don't)
Re-initialise the GUI:
(note the leds are now red)
Try to update the display again:
(this should (and does) clear the leds)
It seems that killing the while loop also kills the GUI process spawned from the shell.