Skip to content

Fixed the windows code so it returns a string of letters or code, but… #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from

Conversation

frastlin
Copy link

… the arrow keys and function keys don't return the correct sequences. I will fix that in the next version, but it will use a keys file with a dict. The current method of variables is not going to work very well for this.
It looks like I changed readchar.readchar.py, but I didn't, I was just trying to figure out how I was going to fix the windows version.
I only modified readchar_windows.py

frastlin added 5 commits July 23, 2015 04:18
… the arrow keys and function keys don't return the correct sequences. I will fix that in the next version, but it will use a keys file with a dict. The current method of variables is not going to work very well for this.
…e 6 have 2 meanings. Find the dict of keys in the keys.py. The reason why there are 2 dicts is because there are 2 processing areas for keys and they overlap. The next task is to convert the linux and mac sets to fit into the same dict format.
…does, waiting for a key, or check if there is a key and if there is process it, otherwise move on. Pass blocked=True if you wish for the program to wait for a key press, enter False (default) if you wish to only return a key if there is a key waiting.
…am to wait for a char to be pressed and pass False if you wish the function to return only when there is a char on the queue.
@krist10an
Copy link

Frastlin,

It would be great to get arrow keys and so on working on Windows, great effort from you!

I think your current implementation is somewhat lacking, since it is not straight forward to write a multi-platform script with this. To use you current implementation I have to do the following:

            inp = readkey()
            if (inp == key.DOWN or inp == "down") and self._active_line < len(self.choices) - 1:
                self._active_line += 1

            elif (inp == key.UP or inp == "up") and self._active_line > 0:
                self._active_line -= 1

While I would expect to be able to just do:

            inp = readkey()
            if inp == key.DOWN and self._active_line < len(self.choices) - 1:
                self._active_line += 1

            elif inp == key.UP and self._active_line > 0:
                self._active_line -= 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants