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.

https://github.com/cknave/python-dos-like/actions/workflows/testing.yml/badge.svg

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.

The lifecycle of graphics, music, and sound loaded from dos-like is not managed, and is likely leaking memory.

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.2.tar.gz (1.8 MB view details)

Uploaded Source

Built Distributions

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

Uploaded CPython 3.10 Windows x86-64

python_dos_like-0.0.2-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.2-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.2-cp39-cp39-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.9 Windows x86-64

python_dos_like-0.0.2-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.2-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.2.tar.gz.

File metadata

  • Download URL: python-dos-like-0.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 3e7e52c1c1442a1839861c60ff5d3f5add66f8db16acbc9e28d841b0aa722c03
MD5 1a33e3aba17eed9c43ff5b7abf65df66
BLAKE2b-256 a7375c7377d4be5228fd370cdd9d108392d2dae6985817fcf3b30e594ff403e3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for python_dos_like-0.0.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 17ac83271d742081602f352a456dfe475a53e420c102c3fd4814f0b58c7d7f01
MD5 dd2e293f115e4462b7ed6cfd584b0264
BLAKE2b-256 89163c779e8d82c029ee88640dd9b4e28be4106fef56ef4f5efd97735426c782

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for python_dos_like-0.0.2-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2148a87bebe838fcbdb0b19b8823d9b6ff04042aa05256b3e91b2a5bfe554535
MD5 8df9549be7f3bb1d23f1240573d0e4dc
BLAKE2b-256 66954431e187e31f73f63b11196e8cfa73846371f1583e91cb4fbda40cf5cedc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for python_dos_like-0.0.2-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 337a024e37f00137645cc72d7e6a7cc2d13ee3dc5235a914e886ff07b29cdbc4
MD5 86c368a6ba72100abe616d6553720df2
BLAKE2b-256 2c1760d7a39399d090f782e091f16a642926d55ceb7bdfdbd6d0b8bf1b256e56

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for python_dos_like-0.0.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 b5d8d61a39f0648f1fef55c87e2bbb950c22d89f9100619b336d9633d6941a21
MD5 4c1db3128318e57c5dd04349f074d6b6
BLAKE2b-256 c1b1d2121a4bea2446ef758643a3195d3643084b44e0a5ab807a3ff16a11d6a7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for python_dos_like-0.0.2-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 62098ee044e5fb2facbf981771d8f512adf705e8ac930d6725fad12e851f63b1
MD5 9aa23484be5e5bdd7f5f3402a198f302
BLAKE2b-256 6d72f0014abc05eac2e9d3618e32cfa1be27c2588a62d7d33eb8f2bc03b1695f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for python_dos_like-0.0.2-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 e0a9afd2a1b843df0d6bdfdaf06ff9bfeda655343f7581e6cda93dac8912eb9a
MD5 b789a1ea2f7f628b827bac9cc15682d7
BLAKE2b-256 b569f9c52d775bcbf7869102b3ee53ffe174c3067019cbc7928f1dead55a24fd

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