I don't understand the purpose of the 'while' loop, and where does it end?
In any event, your code checks for each of the specified keypresses, and doesn't handle key releases at all. You need a keyboard listener that will continuously monitor keyboard events. Sometime ago, I used keyboard commands to control my drone. When the designated key was released, I sent a command to place the drone in a hover mode, i.e.,
tello.send_rc_control(0, 0, 0, 0).
In order to monitor for on_press and on_release keyboard events, I suggest you use the pynput library. See
pynput
I'm attaching an example of using pynput to create a continuous keyboard listener. I modified this from the pynput documentation, in order to prevent key presses from being entered into my code (I'm not sure if the added code will work in your IDE. I use Thonny, and the added code moves the cursor into the Shell area.). Obviously, this code is not designed for
Tello, but if you remove the print() statements and add some 'if' statements to handle specific key presses and releases you should be able to achieve what you want.
For a somewhat more detailed explanation of the pynput keyboard listener, see the section entitled 'Monitoring the keyboard' at
Handling the keyboard — pynput 1.7.6 documentation.