You may not need to write that python program. There are so many freely down loadable open source Python programs available on the internet that a program to solve your specific program may have already been written. This does not obviate the need to learn python but a mindset that is open to modifying existing code is worth cultivating.
In September 2020 there were 137,000 known python libraries on the internet. There thousands of programs and modules available from the "Python Package Index" or PIP
That is the Good News, the Not So Good News is that most of the external libraries are written in C and are as YET not available to use on RISC OS. My understanding, is that because the modules in the python3 executable are linked statically only modules written in python can be added.
The Python standard library contains modules written in C that provide access to system function that would otherwise be inaccessible to Python programmers. It also has modules written in Python which provide solutions to common problems. Some modules abstract OS specifics into platform-neutral APIs.
The RISC OS Python install includes the Standard Library.
It consists of 48Mb of data shared accross 2400 directories
and files.
Very little of it has been tested.
I am in the process of testing the Library and will have a page in this document to record progress and status. Any help would be appreciated.
Pygame is an external Library that has been ported to RISCOS.
It is a set of Python modules designed for writing games and multimedia programs in the python language. It interfaces with the cross-platform development library SDL Simple DirectMedia Layer designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D.
Notes on usage and some test results
Pip install only sees the latest version so you will need to download and install the older version 0.1.0 manually.
I suggest you save it inside the !TbxTest application directory where it will be seen and used in preference to the version in the path, and won't be affected by system updates..
Download from here: https://pypi.org/project/riscos-toolbox/0.1.0/ Download the Built Distribution file riscos_toolbox-0.1.0-py3-none-any.whl Using NetSurf this downloads as riscos_toolbox-0/1/0-py3-none-any/whl It comes in as type Data. Change type to zip and open it Drag the directory riscos_toolbox to !TbxTest The !TbxTest run file needs some modification to make it work.
the original !TbxTest app fails with line 47, in initialise swi('Toolbox_Initialise','0Ibbsbb;III', swi.error: Window Manager is currently in use There is a problem with the Run line:- Run <Python3$Dir> <TbxTest$Dir>.!RunImage This line expands to: Python3$Dir : $.Apps.Development.!Python3 TbxTest$Dir : $.PYTHON.....riscos-toolbox-master.!TbxTest so effectively: !Python3 !TbxTest.!RunImage which runs and gives: swi.error: Window Manager is currently in use Changes to !Run file to make it work: add - Set TbxTest$DirDir <TbxTest$Dir> replace Run line and redirect i/o - python3 <TbxTest$Dir>.!RunImage 1>^.s_out 2>^.s_err Place the cherry on top: add to !TbxTest - !Boot !Sprites
© 2021 JR