Programming with Python: Time to upgrade to fancy ANSI
Wordle inspires Dick to reinvent his 1980s ASCII toolkit for the 2020s, but this time he doubles down with ANSI

During the darkest days of lockdown I kept myself amused by practising jazz guitar chords and writing Python programs. I write a lot of small, off-the-cuff programs, for everything from updating phone codes or solving maths puzzles, to playing with simulations to do with Games Theory. Python is just the last of a long list of languages I’ve used – Basic, Forth, Pascal, Lisp and Ruby are a handful of others – but the one I remember with most affection is Turbo Pascal.
My programmes are so small and ad hoc that it’s never worth investing too much time writing graphical user interfaces (GUIs), so Windows was a nuisance rather than a liberation. Although I played with Visual Basic and Delphi for several years, eventually both metastasised into such baggy monsters that I dumped them. I wrote myself a little toolkit in Turbo Pascal 5 that created simple windows, menus and pick-box widgets from ASCII characters, quite good enough. I shared my code in Byte and am proud to say I saw it on screens in more than one science lab where they had similar minimalist requirements.
Now I use QPython 3.6 on Android, which has no native ability for colour or cursor control, just scrolling teletype output. There are plenty of add-on graphics libraries such as Kivy, all way more than I need, and there’s a simple interface to Android dialogues and media components called SL4A that I occasionally use but it’s still not what I had with Turbo.
The impulse to recreate my Turbo widgets was finally triggered by, of all things, Wordle. I enjoy playing Josh Wardle’s clever and elegant little puzzle (almost as much as I deplore posting screenshots on Facebook or bragging about stats). It’s just difficult enough to maintain an interest, but still simple enough to pose real questions over strategy, which is exactly what I love in a game. I never actually cheat but I do use tools that some purists might consider cheating, namely a mobile version of the Oxford Dictionary with wildcard search and an anagram solver; once I have three or four letters these will finish the job in a couple of minutes.
Getting those three of four letters soon enough is what my Python programme does, searching for effective first guesses using the known frequency distribution of letters in English at each position in a five-letter word: it outputs delightful combinations such as AUDIT SNORE CLAMP and CAMEO UNITS GRIND WHELK. I discovered that my old buddy David Tebbutt, one of the founding editors of Personal Computer World, is also fond of Wordle and it was he who sent me the letter frequencies list in a fine example of nerd-aid. He also has access to Wordle’s own internal word list, but in a fit of hubristic rectitude I decided that was a step too far for me.
My Python Wordle Helper program’s scrolling teletype interface became a real bore, and while looking up how to write a clear-screen command using OS calls I discovered how to issue ANSI codes from Python, and hence how to do a 256-colour character-based terminal better than Turbo’s. QPython can in theory access the Linux library, but that refuses to work for me and in any case is pretty horrible. I set to and have now written a widget set that does everything I want, enabling single lines of code to invoke a box, a window, pick list, input box, progress bar, table or bar chart.
I doubt that my new widgets will prove as popular with nerds in science labs as those Turbo originals were; those hark back to when IBM-compatible PCs running DOS were still ubiquitous in technical and process control contexts. I know that there are still far too many public institutions such as hospitals and libraries that retain such dinosaurs, but they will at least be running Windows XP.
Get the ITPro daily newsletter
Sign up today and you will receive a free copy of our Future Focus 2025 report - the leading guidance on AI, cybersecurity and other IT challenges as per 700+ senior executives
Of course, anyone under 70 is using a smartphone instead of a computer anyway, and an ANSI terminal on a smartphone screen is about as welcome as a turd on a sushi. So I’ll keep my little ANSI world to myself, going back and rewiring some of my old programmes using the new interface. My 5-Card Drawer and 5-Card Stud Poker games actually look rather splendid.
-
RSAC Conference 2025: The front line of cyber innovation
ITPro Podcast Ransomware, quantum computing, and an unsurprising focus on AI were highlights of this year's event
-
Anthropic CEO Dario Amodei thinks we're burying our heads in the sand on AI job losses
News With AI set to hit entry-level jobs especially, some industry execs say clear warning signs are being ignored
-
Big tech promised developers productivity gains with AI tools – now they’re being rendered obsolete
Opinion Big tech promised software developers huge benefits with AI tools, but now they face job cuts as companies ramp up automation.
-
Anthropic’s new AI model could be a game changer for developers: Claude Opus 4 ‘pushes the boundaries in coding’, dramatically outperforms OpenAI’s GPT-4.1, and can code independently for seven hours
News Claude Opus 4 boasts huge performance capabilities and is fine-tuned for software developers.
-
‘It’s far from showing its age’: Java might’ve just turned 30, but it’s still going strong and here to stay
News With Java celebrating its 30th anniversary, we look at the rise of the programming language and what the future holds.
-
Python’s popularity shows no signs of fading – here’s why software developers love it
News Python remains highly popular among developers for a number of key reasons, experts told ITPro.
-
AWS expands language support for Amazon Q Developer
News AWS has expanded support for languages in Amazon Q Developer, making it easier for developers to code in their first language.
-
AI was a harbinger of doom for low-code solutions, but peaceful coexistence is possible – developers still love the time savings and simplicity despite the allure of popular AI coding tools
News The impact of AI coding tools on the low-code market hasn't been quite as disastrous as predicted
-
‘We’re trading deep understanding for quick fixes’: Junior software developers lack coding skills because of an overreliance on AI tools – and it could spell trouble for the future of development
News Junior software developers may lack coding skills because of an overreliance on AI tools, industry experts suggest.
-
GitHub's new 'Agent Mode' feature lets AI take the reins for developers
News GitHub has unveiled the launch of 'Agent Mode' - a new agentic AI feature aimed at automating developer activities.