TI-84 Plus CE, V5.6

Using Python, I want to make a selection from a displayed menu so I need to get the text or position under the cursor.

Any suggestions?
TI-84 Plus CE, V5.6

Use a different variable to keep track of what menu item is selected.
Then modify the variable depending on what key is pressed.

Suggestion given.
I see your suggestions.

For instance, the displayed screen might look like:

1. choice 1
2. choice 2
3. choice 3

as I use the up/down arrows to scroll from 1-3, if at any time I press enter or 1,2,3 I need to know what value was selected.

Would the preferred method be to monitor key presses, ie, whether the key-press is 1, 2, 3 or enter?

Any ideas?
Understood.

That is correct, you can increment the variable if the down key is pressed, and increment if up is pressed.
And then use enter to accept the selection.

Idea provided.
To find the current key press in TIBasic appears to be easy using getKey().

I don't see how to do this is TI-Python. It's not that obvious after searching google.

I have 2 questions:

1. How can I look at the installed libs on the TI-84 (using TI_Connect)? So I want to do a simple "dir" command or something similiar.

2. Using TI-Py how can I detect a keypress, I have V5.6?

More suggestions?
1. I don't know if you can; but it should be able to show the appvars which contain the information
2. The wait_key function should be able to do this. (part of the ti_system module)
jackmanjls wrote:
To find the current key press in TIBasic appears to be easy using getKey().

I don't see how to do this is TI-Python. It's not that obvious after searching google.

I have 2 questions:

1. How can I look at the installed libs on the TI-84 (using TI_Connect)? So I want to do a simple "dir" command or something similiar.

2. Using TI-Py how can I detect a keypress, I have V5.6?

More suggestions?


1. You can do help("modules") to see all the installed modules, you can then use dir(<object>) which returns a list of the attributes and methods of any object.

2. I'm not familiar with the Python implementation on TI-84, but you can use get_key() function on Nspire to get the key press.

Hope this helps Smile
You have ti_system.wait_key() which will pause until the user presses a key (possibly with the 2nd or Alpha modifiers) and it then returns the key code value to the program.

You can use something simple to see how this works and what key code values you get:

Code:

import ti_system
while True:
  print(ti_system.wait_key())


(press the ON key to break out of the program loop when you're done)

You could use this to watch for the up and down arrows and highlight the current row in your "menu", as well as looking for shortcuts like 1, 2, 3, 4 or whatever and ENTER to indicate selection of the currently highlighted row.

A handy function might be something that will take a list of menu items, display them each on a new row on the screen prefixed by shortcut numbers, highlight the first row with a different color, then loop on wait_key() looking for enter, a shortcut number, or up and down keys. For up and down you change which row is highlighted and keep track of the current row. The function could return the index in the list of the selected item or something else to indicate they cancelled/escaped or whatever.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement