[Tutor] Event loop logic question
Phil
phillor9 at gmail.com
Sat Jun 25 20:06:25 EDT 2022
On 26/6/22 08:59, Alan Gauld via Tutor wrote:
>
> I don't know your particular framework but as a general rule UI
> changes should be in the paint/draw/update function and only
> state data changes in the event handlers.
Thank you Alan once again for your time and your comments are always
welcome.
I was looking for an easy way to repeatedly read the keyboard and
pygamezero fills the bill. The problem that I initially had was that the
update function is called many times per second and sending control
commands from there caused the receiving hardware to be overwhelmed and
then to crash. The UI is a 20 * 20 square and servers no use at all,
it's just a requirement as far as I can tell, and so does not need
updating. All I need is to read the arrow keys and to be able to quit
the programme.
There is no need for any user output to be displayed on the transmitting
laptop, the print statements were just a debugging aid. Briefly, I SSH
from my laptop to a raspberry pi via my mobile phone created WiFi
network. No doubt it's an amateurish solution, however, it's simple and
does exactly what I had intended.
--
Regards,
Phil
More information about the Tutor
mailing list