You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Any Python script is halted by the [ ↰ ] key next to [OK], so it’s impossible to test keydown(KEY_BACK) in a program.
To Reproduce
Steps to reproduce the behavior:
Write a minimalist Python script like the one below: from ion import * print("BACK not pressed yet") while True: if keydown(KEY_BACK): print("BACK key pressed")
Execute the script
Press the [ ↰ ] key
The script halts, with the message: KeyboardInterrupt:
Expected behavior
If a Python script involves a test with the BACK key, it should not be halted by this key — the ON key is a “solution” to halt the program anyway.
Environment
Online simulator (version 23.2.1)
Actual device (version 24.0.1)
The text was updated successfully, but these errors were encountered:
fromionimport*importmicropythonasmpmp.kbd_intr(KEY_OK) # Bind the OK key to KeyboardInterrupt instead of the Back key
It's used by some games. I don't know if it's an intended feature, but it's really useful for such use. I don't think disabling the behavior would be useful as it's possible to exit everything using Home/Power since version 16 (which broke games as playing using the top keys is way easier than with the small keys).
On version 15 and before, this feature must be used with caution as it's impossible to exit the script without explicit exit from the script itself (it's not a concern for NumWorks as they probably only care for the new versions, but if you are deploying your script on a lot of calculators, some people use outdated software as they never update, or are running custom firmwares based on version 15).
Automatically disabling the back key could be a solution, for instance once keydown(KEY_BACK) is called once, the KeyboardInterrupt would be disabled for the rest of the execution of the script.
It would be interesting to know the official position for NumWorks for this use case (I'm not affiliated to NumWorks in any way, I'm just one of the contributors on a custom firmware on old NumWorks calculators and maintain some external apps).
Describe the bug
Any Python script is halted by the [ ↰ ] key next to [OK], so it’s impossible to test
keydown(KEY_BACK)
in a program.To Reproduce
Steps to reproduce the behavior:
from ion import *
print("BACK not pressed yet")
while True:
if keydown(KEY_BACK):
print("BACK key pressed")
KeyboardInterrupt:
Expected behavior
If a Python script involves a test with the BACK key, it should not be halted by this key — the ON key is a “solution” to halt the program anyway.
Environment
The text was updated successfully, but these errors were encountered: