I'm using this code so that users can select menu choices with the number keys:
Code: Select all
for n, i in enumerate(items, 1): # n would be the number starting from 1
if n<10:
key str(n) action i.action
textbutton str(n) + ". " + i.caption action i.action style "nvl_button"
1. Choice 1
2. Choice 2
Users can choose by pressing 1 or 2 on the keyboard.
However, if an option is insensitive, for example:
menu:
"choice 1" if stat > 0:
pass
"choice 2":
pass
In the case that the variable "stat" was at 0, they will be able to see that menu option, but they can't choose it. With my code above, they can't click on it, but if they press 1 on the keyboard, it still lets them choose that option. Is there anyway to disable keyboard input for insensitive choices?