Skip to main content

Python bindings for the dos-like programming library

Project description

python-dos-like is a set of Python bindings for the dos-like programming library by Mattias Gustavsson.

Tests status Documentation Status

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

This library has been tested on Linux and Windows. It builds on macOS, however running in the background raises an AppKit assertion. Building on WebAssembly should be a real challenge.

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-dos-like-0.0.3.tar.gz (1.8 MB view details)

Uploaded Source

Built Distributions

python_dos_like-0.0.3-cp310-cp310-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.10 Windows x86-64

python_dos_like-0.0.3-cp310-cp310-manylinux_2_28_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.28+ x86-64

python_dos_like-0.0.3-cp310-cp310-macosx_10_15_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.10 macOS 10.15+ x86-64

python_dos_like-0.0.3-cp39-cp39-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.9 Windows x86-64

python_dos_like-0.0.3-cp39-cp39-manylinux_2_28_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.28+ x86-64

python_dos_like-0.0.3-cp39-cp39-macosx_10_15_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.9 macOS 10.15+ x86-64

File details

Details for the file python-dos-like-0.0.3.tar.gz.

File metadata

  • Download URL: python-dos-like-0.0.3.tar.gz
  • Upload date:
  • Size: 1.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for python-dos-like-0.0.3.tar.gz
Algorithm Hash digest
SHA256 4399c15e0c07ca90cf862d9c67dd5c73206c8b36c90ea5a6b1f0270d32089f96
MD5 2144d63a37c35c9cb0e3a416ca0c9611
BLAKE2b-256 b3cf4081abd41baf25681437f5c3c1de729acc1a6858de0dbea06b0438f146f4

See more details on using hashes here.

File details

Details for the file python_dos_like-0.0.3-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for python_dos_like-0.0.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 2b14a54991ad1380f3be21955833308565d37d398e988e64dd31d8edbffeb438
MD5 6bda0392acd83f153d0cebcc982e105a
BLAKE2b-256 9a1a7f04a6c16bc3118acf33cdc2f08bd74bfdc641c3f095af28c5481ebfc07a

See more details on using hashes here.

File details

Details for the file python_dos_like-0.0.3-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for python_dos_like-0.0.3-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9a36483f6c90205fdbebf670b9b47ef628c3a8ceea8c15a385fee787effd24e8
MD5 5a3989c69f7c5a5d9b5ab7402ad342ec
BLAKE2b-256 d413e17aa2a0432f5bfdf365c6f4ffdb2fd55f5e15ad221fbd371a5d25bbdf83

See more details on using hashes here.

File details

Details for the file python_dos_like-0.0.3-cp310-cp310-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for python_dos_like-0.0.3-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 8d96d1ecb9b075b6d40dfb03c877a202ba73f96d5902d3ff111117b5843a83be
MD5 56dcd6fbec27a14dc6ca564426039af8
BLAKE2b-256 272471e32206fb7141174797eba65380488185d2129ade6d43da113fe94e0a61

See more details on using hashes here.

File details

Details for the file python_dos_like-0.0.3-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for python_dos_like-0.0.3-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 074359f2a7f0fc64051d2c01b3df30c15a4fd3d2aaf86eeabb7dbaca69471dcd
MD5 38c9aeef806bbfc1dafcc93569127998
BLAKE2b-256 f2564f053bed0fc9d8f9f51eddf999ca7add84cb0ff085103376964f7ed0b28a

See more details on using hashes here.

File details

Details for the file python_dos_like-0.0.3-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for python_dos_like-0.0.3-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c4ecda83754b4714fe15e7fbcee90ade2da748ff573bac8057cdd11e3cfe21cf
MD5 89f0cbbdf202bfa441026f5cfd913dec
BLAKE2b-256 de7f326fc412d69d2f8459d4a325eb7951f683aff46e889107e393bf3d933d59

See more details on using hashes here.

File details

Details for the file python_dos_like-0.0.3-cp39-cp39-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for python_dos_like-0.0.3-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 0ad961c215c5e83b43ad306eeb0616c1980d48a0a21e0747ebe384dcd5c9bcfd
MD5 3bfef8bd39815a022e692bd06dd10a09
BLAKE2b-256 b42853c6d5f200975d742af3f3a25cfead19004c521cbfe69e5e4a53fd60bebc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page