Looking for free software including mechanism equivalent to that of Simple Writer
Moderators: phlip, Moderators General, Prelates
-
- Posts: 15
- Joined: Mon Oct 31, 2016 10:19 am UTC
Looking for free software including mechanism equivalent to that of Simple Writer
I am looking for a free software with which I could implement things equivalent to the mechanism realized by Simple Writer, i.e. checking the words in an input window against a given list of words and turning the colour of those words not in the list from black to red. I tried tkinter of Python, but it appears to be no means there to do that (or perhaps only in a very tedious round-about and hence practically not acceptable way).
- chridd
- Has a vermicelli title
- Posts: 805
- Joined: Tue Aug 19, 2008 10:07 am UTC
- Location: ...Earth, I guess?
- Contact:
Re: Looking for free software including mechanism equivalent to that of Simple Writer
One way is to use a text editor that has customizable syntax highlighting (like Vim; I assume Emacs would work as well), and set up the syntax highlighting to highlight the words in the list.
~ chri d. d. /tʃɹɪ.di.di/ (Phonotactics, schmphonotactics) · she(?)(?(?)(?))(?(?(?))(?))(?) · Forum game scores
mittfh wrote:I wish this post was very quotable...
flicky1991 wrote:In both cases the quote is "I'm being quoted too much!"
- Soupspoon
- You have done something you shouldn't. Or are about to.
- Posts: 2959
- Joined: Thu Jan 28, 2016 7:00 pm UTC
- Location: 53-1
Re: Looking for free software including mechanism equivalent to that of Simple Writer
OP is asking for non-list words to be highlighted. Simple keyword highlighting would do the opposite crom that asked. (Could be done by setting default formatting as 'highlit' and then highlight with 'no highlighting' format, plus arrange for all non-alphabetic cruft to also be 'dehighlighted', but that last bit might be hard, unless regexpy capabilities exist, in which case there are probably simpler ways to 'highlight if not in list' anyway.)
For the Python Tkinter method, I've a feeling that using a hidden but active (and autofocussed/permanently tied as keyboard-magnet) text input (Entry) field that is tied/whatever, perhaps with a trace lamba method, to a function that then writes1 to a text output (Text) widget, after intermediate processing to identify points of necessary highlighting and SELectively adjust the foreground.
Assuming that Text itself doesn't accept its own 'entry' (not too familiar with Python in Tkinter mode, I'm largely extrapolating my experience with other languages from Delphi to Perl/Tk). But if you do go down this road, you might find it useful to also do something (put a "|" in alternating foreground/background colour on a timer-tick?) to mark the cursor position upon the faux-editor widget.
1 Perhaps anew, from scratch, upon each and every change, perhaps only needing to alter local text.
For the Python Tkinter method, I've a feeling that using a hidden but active (and autofocussed/permanently tied as keyboard-magnet) text input (Entry) field that is tied/whatever, perhaps with a trace lamba method, to a function that then writes1 to a text output (Text) widget, after intermediate processing to identify points of necessary highlighting and SELectively adjust the foreground.
Assuming that Text itself doesn't accept its own 'entry' (not too familiar with Python in Tkinter mode, I'm largely extrapolating my experience with other languages from Delphi to Perl/Tk). But if you do go down this road, you might find it useful to also do something (put a "|" in alternating foreground/background colour on a timer-tick?) to mark the cursor position upon the faux-editor widget.
1 Perhaps anew, from scratch, upon each and every change, perhaps only needing to alter local text.
Re: Looking for free software including mechanism equivalent to that of Simple Writer
mok-kong shen wrote:checking the words in an input window against a given list of words and turning the colour of those words not in the list from black to red
...or turning the colour of the words that are in the list from red to black. (which is easier to achieve with most highlighting tools)
chridd wrote:One way is to use a text editor that has customizable syntax highlighting (like Vim; I assume Emacs would work as well), and set up the syntax highlighting to highlight the words in the list.
Or if you're not working in a terminal window all day: Notepad++ has an easy-to-use dialog for making custom syntax highlighting, whereas Atom, Sublime Text, VS Code, Brackets and whatnot allow custom highlighting via a configuration file (like vim and emacs).
Spoiler:
Who is online
Users browsing this forum: No registered users and 12 guests