WPM Trainer
A Windows desktop app, written in Python with PyQt6, that keeps you writing. Set a words-per-minute target and it plays a chime each minute you hit it and a buzzer each minute you miss.
- Python
- PyQt6
- matplotlib
- pynput
Overview
I write, and I tend to edit my first drafts to death. I can lose an hour on one paragraph. WPM Trainer is the tool I made to stop myself. You pick a words-per-minute target and a number of minutes, press Start, and write in whatever program you like. At the end of every minute the app checks how many words you typed. If you hit the target you hear a chime, and if you didn’t you hear a buzzer.
A low target works best for me. At 10 words per minute there is still time to think, but the session adds up to at least 600 words an hour.
The window with a made-up sample session, so the graph has something to show.
What it does
- Sets a target in words per minute and a session length in minutes.
- Has a Presets menu, from 500 words an hour up to 6,000.
- Draws a graph of the session, with a green bar for each minute that met the target and a red one for each that didn’t.
- Has a Statistics tab with the session time and the current minute, a sound toggle, and Stop and Reset buttons.
How it’s built
The window is built with PyQt6: a menu bar, an options box, buttons, and a tabbed area for the graph and statistics. A Qt timer ticks once a second and counts up to each minute. The chime and the buzzer are Qt sound effects. The graph is a matplotlib chart embedded in the Qt window, which took some configuring to get working.
Counting the words is the job of a small class that wraps a keyboard listener from the pynput library. It watches the keys, strips out anything that isn’t a letter, number or space, and counts the words. At the end of each minute it checks the count, and then starts again from zero.
The keylogger question
To count words in whatever program you happen to be writing in, the app has to see every key you press. That makes it behave like a keylogger, and some antivirus programs flag it for that reason. The README has a section on it, so people don’t have to find out the hard way. It says what the app records and how to check:
- Keystrokes are only recorded while a session is running.
- What it has recorded is thrown away every minute, and the results are discarded when a session ends, is reset, or the app is closed.
- The README points to the two source files that handle keys, so anyone can read them and check.
If you support other people’s computers, this kind of thing comes up a lot: software that is harmless, but looks suspicious to a security tool. The best answer I know of is to say plainly what a program does.
Where it stands
It only runs on Windows for now. One small reason is a Windows call that makes the icon show up properly in the taskbar. There is one item left on my to-do list: a confirmation before the Reset button throws away a session.