2

I am writing an interpreter in Python where the user has to type Prolog code and I'd like to implement dynamic syntax highlighting. So far my application (which should be cross-platform) is reading input and printing from/to the command prompt (on Windows). I've been looking at the pygments library, but I have no clue on how to modify the current line (being typed) on the command prompt.

So, I've also been looking at the curses library to implement an UI but that would leave Windows users out. Any suggestions? I just need to implement a quick UI to be able to dynamically highlight what is being typed.

1 Answer 1

1

It appears that you can't wait for a return. To deal with input one char at a time you need something like getch.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.