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.

Usage

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

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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.10 Windows x86-64

python_dos_like-0.0.1-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.1-cp39-cp39-manylinux_2_28_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.28+ x86-64

File details

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

File metadata

  • Download URL: python-dos-like-0.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 3e377e81fec9d39817137dad5f74be8712b7b46c5ebbf836e0316def4eff0ff6
MD5 44b8d45d858073eaa435471268ce7d3d
BLAKE2b-256 c8df0ae8ee1910960e6c5ea7395c5d0a9d64fb77f1d1e58a0e4968129988309b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for python_dos_like-0.0.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 1cd43234e9a4bae969012fd633bed4e1eeb5cd2bbdd795cf9399c35f1f85143a
MD5 13f5c4713d6432722e6e3bd8a818ea88
BLAKE2b-256 5d57c40e7b50d084c92571563059be011b436a514a33f88e16c68db93dcbeef3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for python_dos_like-0.0.1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ad210d8422ca6a4fdf0f9c95a876bb95fa5d8a22894af2c2a40e99cbd760da88
MD5 4864fe02018c7a66ea3cc441a041c4a1
BLAKE2b-256 b5e7692ca64e3016971c62ae5845c9742f934a4182dba73630b05ecf287512bd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for python_dos_like-0.0.1-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9530ba8bb7439be819322a9f31618e63927fd93748aa9a2ee81a55bbcf33790c
MD5 b46ea5695a76777cf5bbac380cda4942
BLAKE2b-256 5b2c92559cb2f7887cb533a42859aa2f500a49154844ab0a687df75471bfeac3

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