Short: UNIX style escape codes for Python Author: wisecracker.bazza@gmail.com (Barry_Walker, G0LCU) Uploader: wisecracker bazza gmail com (Lincs Amiga Group, LAG) Type: dev/src Version: 0.00.10 Architecture: m68k-amigaos; generic Distribution: Aminet ============================================================================= Architectures: Classic AMIGA A1200(HD), FS-UAE on OSX 10.15.x and Mint 22.3. ---------------------------------------------------------------------------- MINIMUM Requirements Are:- -------------------------- Amiga environment:- ------------------- Classic STOCK AMIGA A1200(HD), default OS3.0x install. FS-UAE on Intel APPLE OSX 10.15.x and GNU/Linux Mint Cinnamon 22.3. Standard default AMIGA OS_3.0.x install, or better still a highly expanded AMIGA with extra RAM will speed things up considerably. Python Version 1.4.0 on Classic AMIGA A1200(HD) OS3.0x:- https://aminet.net/package/dev/lang/Python_14 This version that requires no extra hardware at all:- 'python_020_ieee' Python Version 1.5.2 to 2.0.1 on '030+ highly expanded AMIGAs OS3.0x. AmigaMicropython340 on Classic AMIGA A1200(HD) OS3.0x. https://aminet.net/package/dev/misc/AmigaMicropython Also as a matter of interest these Python scripts also work inside the excellent ADE, the *NIX emulation, but the STOCK AMIGA A1200(HD) needs at least an extra 4MB of FastRAM to do so:- https://aminet.net/package/dev/gcc/ADE ----------------------------------------------------------------------------- Other environments:- -------------------- Any Python version from 2.x.x to 3.15.0rc3 on Intel APPLE OSX 10.15.7. Any Python Version from 1.3.0 to 3.12.x on GNU/LINUX MINT CINNAMON 22.3. It has NOT been tested on WinUAE emulation of the above, Windows, and WSL[-2], with a Python Version installed. It has NOT been tested on any 'M' series APPLE gear either. (CygWin has 'mintty' and it supports at least much of what is done here already as I have used it in the past.) ============================================================================= History:- --------- 21-08-2026. ----------- Version 0.00.10. As you can see from the first upload these terminal escape sequences are not what you would expect, nothing 'escapes' when one has to make something work on any platform AND Python version. Have fun with this next step. ========================================================== GENERAL section; added a Prefix Only function, 'po()', for multiple prefix usage, INCLUDING the colours! INTERMEDIATE section; added Extended Colours function to obtain foreground colours 90 to 97, and background colours 100 to 107, used in many modern terminals. ADVANCED section; added 24 bit colour functions 'fg24()' foreground colours, and 'bg24()' background colours. Also added a file 'graphics.py' to demonstrate and test graphics mode inside many modern terminals. 'graphics.py' is added to demonstrate importing 'ESC' to do the task. There will be loads more to add over time. (Added all the relevant tests as required now.) 07-08-2026. ----------- Version 0.00.01. Taster upload to see if people are interested. The archive is (C)2026, Barry Walker, and issued as PD, Creative Commons CC0 licence. (140 DLs, so people are interested.) ============================================================================= General:- --------- (Apologies for any typos, etc...) A compilation of UNIX style 'xterm' terminal escape codes designed to run inside Python of any version but biased towards the AMIGA A1200(HD)! If you NEED to suppress the final newline inside any 'print' statement or 'print()' function in your code then read the Python Manual for your version, I should not have to show you how to do that. HOWEVER, there are five files to make life easier for you on AMINET. Just go to AMINET and type in, without the quotes, inside the search box:- "Backwards Compatibility" and 5 files show version 1.4.0 to 3.15.0rc3 similarities for 'print' AND 'print()'. There are four _Gemini_ images of all the default AMIGA[-]Shell escape codes in AMIGA format, and eventually most, if not all of these, will be transferred to 'xterm' format. ----------------------------------------------------------------------------- !!! IMPORTANT !!! ----------------- If you have uploaded an earlier version of this archive then DELETE ANY 'ESC.pyc' and/or 'ESC.pyo' files that exist so that new current versions can be created, either inside the'__pycache__ folder or the folder where 'ESC.py' is. Also there WILL be a random terminal that will be unable to use some of the more advanced escape sequences so be well aware. ----------------------------------------------------------------------------- !!! REMEMBER !!! ---------------- The Classic AMIGA does not have the luxuries of the current, (as of the above date), Python Version 3.15.0rc3 and its massive (C)2026_Pytho[-]System, so these recipes might help towards using what we have and inspiring others to add to them. They can be anything, not just mathematics, (like my others). The difficulty is learning and memorising _ALL_ of the differences between Python Versions, (1.3.0), 1.4.0 to 3.15.0rc3; there are a great many, believe me! (Creating workarounds has become second nature to me nowadays.) Although UNTESTED, non[-]Commodore AMIGA variants might work up to the INTERMEDIATE level as the Python versions are up to MicroPython 3.4.0. AROS even has the current 3.14.7 !!! WOW !!!, and 2.5.2 for other variants. And finally, it's better to have something for a retro[-]computer that does NOT have that facility, TO have it, than TO NOT have it at all, no matter how fast the code may or may not be in use! !!! EXTRA NOTE !!! ------------------ The Python file can be either sourced OR import[ed]. I should not have to explain how to use it in either format. The 'print' statement or 'print()' function is needed to call these escape codes for them to work. The test functions however do NOT need need the 'print' facility as they are inside each test function. Assuming 'ESC' has been imported as shown then they are called as:- >>> import ESC >>> ESC._test() and away you go. Also as an alternative to 'print' and 'print()' there is..... >>> import sys .....which has, 'sys.stdout.write()', which has its own foibles over the huge version range, should work well enough, BUT IT HAS NOT BEEN TESTED! ============================================================================= IMPORTANT:- ----------- The Legal Stuff:- ----------------- The authors are not responsible for any damage to, or loss of, or failure of equipment or data caused in any way by the use of this code. There is NO warranty with the use of this software release and YOU USE IT AT YOUR OWN RISK. ----------------------------------------------------------------------------- Testing Evaluation:- -------------------- Classic STOCK AMIGA A1200(HD). FS-UAE emulation of Classic AMIGA test conditions were/are running standard OS 3.0.x and using standard ~topaz 8~ fonts throughout. I have no idea what strange configuration setups will create so refer to the ~The Legal Stuff~ above. The whole archive was centred around the AMIGA! APPLE OSX 10.15.x and MY Linux flavour were included to make the code as universal as possible without any modification at all. ============================================================================= Barry Walker, G0LCU. wisecracker.bazza@gmail.com ----------------------------------------------------------------------------- A place to visit, literally and URL wise:- https://lincsamiga.org.uk/wordpress/ ----------------------------------------------------------------------------- A very useful HardWare related site, (C) Anthony Hoffman, for modifications, schematics, repairs and the like is:- http://amiga.serveftp.net/ =============================================================================