python-dos-like is a set of Python bindings for the dos-like programming library by Mattias Gustavsson.
Documentation: https://python-dos-like.readthedocs.io/en/latest/
Source Code: https://github.com/cknave/python-dos-like
Usage
pip install python-dos-like
python-dos-like can be used in the same way as dos-like by calling dos_like.start on your main function:
from random import randrange
import dos_like
from dos_like.dos import *
def main():
setvideomode(videomode_320x200)
while not shuttingdown():
waitvbl()
for _ in range(50):
setcolor(randrange(256))
line(randrange(320), randrange(200), randrange(320), randrange(200))
setcolor(randrange(256))
fillcircle(randrange(320), randrange(200), randrange(30))
setcolor(randrange(256))
circle(randrange(320), randrange(200), randrange(30))
dos_like.start(main)
You can also use python-dos-like in the Python REPL by calling dos_like.run_in_background:
>>> import dos_like
>>> from dos_like.dos import *
>>> dos_like.run_in_background(['-w'])
>>> cputs('hello world!')
Building
Building python-dos-like requires C development tools to be installed.
On Linux and macOS, the SDL2 and GLEW libraries are required.
If building from a git repository, you must update submodules to get the dos-like source.
git submodule update --init --recursive
$ python -mvenv .venv
$ . .venv/bin/activate
(.venv) $ pip install -e '.[dev]'
(.venv) $ coverage run -m unittest && coverage report
Several environment variables may be set to control compile-time options:
Environment variable |
Default |
Description |
|---|---|---|
ALWAYS_UPDATE |
1 |
Update the screen in the background. Set this to 0 to restore dos-like’s default behavior of pausing updates when the window loses focus. |
CFLAGS |
Extra compiler flags. Of note, -DNULL_PLATFORM is useful to build a library for headless build servers. |
Limitations
Memory management
Memory allocated by dos-like will be freed when its corresponding bython buffer object is garbage collected. The current draw target and music will be retained even if no other python code has a reference, but any playing sounds will not be. Deleting or releasing the last reference to a playing sound may cause issues.
Platforms
This library has been tested on Linux, Windows, and macOS.
macOS does not support GUI operations in a background thread, so it cannot be used from the Python REPL by calling run_in_background().
python-dos-like can be compiled as a WebAssembly Pyodide module, but will fail to import due to a missing symbol from WAjic. Even if this symbol (J, an object containing JS functions to be called from C) is added to the imports when loaded by Pyodide, it does not appear to be compatible.
It is not clear to me what the best way forward is for WebAssembly support: getting a Pyodide module to import WAjic functions, building a Pyodide module in WAjic, or removing Pyodide or WAjic from the project entirely.
Metadata
Release files for python-dos-like 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| python-dos-like-0.0.4.tar.gz | 1.8 MB | Without provenance | Details for python-dos-like-0.0.4.tar.gz |
Built distributions (wheels)
Total release size: 11.9 MB
Release files / python-dos-like-0.0.4.tar.gz
| Download URL | python-dos-like-0.0.4.tar.gz |
|---|---|
| Size | 1.8 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1e45cbd6af2065305801b51322d14a9a5b0dd9b66999eda3fbcf5f6cc4af70ff
|
|
BLAKE2b-256 checksum How to use checksums |
9cc46ada218dcfe1529c79312af18f1028ef1ad2144be9f80f60e425c4b3404e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Release files / python_dos_like-0.0.4-cp310-cp310-win_amd64.whl
| Download URL | python_dos_like-0.0.4-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
dc115fb894803f6b3d81f2520bd11e1eb7e850a432d50d88c6c3030f75a4e428
|
|
BLAKE2b-256 checksum How to use checksums |
c98d98934d741088ffaf64f7ffb29b00f26e72a373ce325b9342ab7925a5b89c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Release files / python_dos_like-0.0.4-cp310-cp310-manylinux_2_28_x86_64.whl
| Download URL | python_dos_like-0.0.4-cp310-cp310-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 2.4 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
0b31cd105516547f7f3f5f47a7bb2a8ca64c47370ec6f6d9941ed1a57d792e3a
|
|
BLAKE2b-256 checksum How to use checksums |
0c3b885212d048b9de50910e24c098906d8e1ff20339ce992aadee51d6c4b9b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Release files / python_dos_like-0.0.4-cp310-cp310-macosx_10_15_x86_64.whl
| Download URL | python_dos_like-0.0.4-cp310-cp310-macosx_10_15_x86_64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.10 macOS 10.15+ x86-64 |
|
SHA-256 checksum How to use checksums |
8c8c772d147c21140fc225cb39b9d38013998c69224d91b75adcd5abdcb26199
|
|
BLAKE2b-256 checksum How to use checksums |
fe328cd4bfd0a7492ed39670330f4474b83ba3f3f04d3e200ccf44513bcf798d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Release files / python_dos_like-0.0.4-cp39-cp39-win_amd64.whl
| Download URL | python_dos_like-0.0.4-cp39-cp39-win_amd64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.9 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
5f93ba9b7e16f88484846ed9a814e2de1b943732d0a0fb165bfae46002834fdb
|
|
BLAKE2b-256 checksum How to use checksums |
2c054bbb7d084c51c57300024f52e35c40f8646333d2aeb76ab6e98cc213ab47
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Release files / python_dos_like-0.0.4-cp39-cp39-manylinux_2_28_x86_64.whl
| Download URL | python_dos_like-0.0.4-cp39-cp39-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 2.4 MB |
| Tags | CPython 3.9 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
cc5c2e23b8990da7747da89a8883099c9acb9333402b012faddb35dabcd0d4a3
|
|
BLAKE2b-256 checksum How to use checksums |
b0a460cf427dc6c24e28e9146a92de4c8fb42df38561cf9cc448e4fd2045a1e3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Release files / python_dos_like-0.0.4-cp39-cp39-macosx_10_15_x86_64.whl
| Download URL | python_dos_like-0.0.4-cp39-cp39-macosx_10_15_x86_64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.9 macOS 10.15+ x86-64 |
|
SHA-256 checksum How to use checksums |
f2e0edf213edc39ab92be7877e16f067dc6d6d088b36b9e4e2c674ff01649766
|
|
BLAKE2b-256 checksum How to use checksums |
2cb2e1a1acf7ea8e126175e4310028b7e8b665812938c96e6b950b019ad50952
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Security for python-dos-like 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.