A virtual memory device drawn by python's turtle
Project description
turtlebyte.py
Turtlebyte is a thing I did for fun. It uses Python's turtle module to store memory by drawing it on your screen. I plan to use it for some silly things in the future.
Installation
pip install turtlebyte --upgrade
Usage
First, instantiate a Turtlebyte object:
from turtlebyte import Turtlebyte
tb = Turtlebyte()
There are two main operations you'll use in turtlebyte:
write_bytes(address: bytes, data: bytes) -> bool
-
Writes the bytes of data at the given address
-
Args:
- address (bytes): The address to write at
- data (bytes): The data to write
-
Returns:
- bool: True if write operation is successful
read_bytes(address: bytes, num_bytes: int) -> bytes
-
Reads the data at given address
-
Args:
- address(bytes): The address to start reading from
- num_bytes(int): The number of bytes to read
-
Returns:
- bytes: The bytes found at the address
Configuration
All configuration is passed to the initial Turtlebyte object. Optional settings (which you will most likely have to experiment with) and their defaults are:
turtle_pen_size: 10turtle_speed: 1000(turtle has a maximum speed)turtle_screensize_x: 600turtle_screensize_y: 600turtle_window_buffer: 6- This is the automatic border that comes with the
tkintercanvas. On my device it's 6 pixels
- This is the automatic border that comes with the
show_animation: False- If this is enabled, the turtle will move across your screen as it writes or reads. It's slow, so I prefer to leave this off and just set a low refresh interval
refresh_interval: 10- This is the number of bytes between screen updates in
write_bytesandread_bytes
- This is the number of bytes between screen updates in
grid_width: 2- The number of columns in the grid of data blocks
grid_height: 2- The number of rows in the grid of data blocks
Example Usage
from turtlebyte import Turtlebyte
tb = Turtlebyte(
show_animation = True,
turtle_pen_size = 15,
turtle_speed = 20,
grid_width = 2,
grid_height = 2
)
msg = b'Hello world!'
tb.write_bytes(b'\x00', msg)
print(tb.read_bytes(b'\x00', len(msg)))
input()
Note that the program does not stay open automatically after it has reached the end of its lifespan, thus the input() call.
Random Notes, for Those Interested
The default block size is 32 by 16 bytes for 512 bytes. I have yet to experiment with other block sizes. You are welcome to, but no promises.
The blocks do not affect the way data is processed, it's entirely for effect.
Each cell is one byte. If you don't feel like slowing down the animation to see what's going on, the byte is 4 bits wide and 2 bits tall. The 8 bits are written top left to top right, down, then bottom right to bottom left.
Cells are written top left to bottom left in the block, then top to bottom on the next column until the block is full.
Blocks are written top left to bottom left, then top to bottom on the next column until the grid is full.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file turtlebyte-0.2.0.tar.gz.
File metadata
- Download URL: turtlebyte-0.2.0.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0edd56af1d21e46d2d47ffebf389314a032b07ac208f8f8845fcd2bd8f77037
|
|
| MD5 |
ccc15cc41b7881bdb602b8fdf0cd894f
|
|
| BLAKE2b-256 |
6ce47883b605a82da0e798f97a59337a0137a2c6cb058e3f480da681a2d820cb
|
Provenance
The following attestation bundles were made for turtlebyte-0.2.0.tar.gz:
Publisher:
python-publish.yml on isaac1000000/turtlebyte
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
turtlebyte-0.2.0.tar.gz -
Subject digest:
a0edd56af1d21e46d2d47ffebf389314a032b07ac208f8f8845fcd2bd8f77037 - Sigstore transparency entry: 246698348
- Sigstore integration time:
-
Permalink:
isaac1000000/turtlebyte@f84570b28d4db625c46f2be8bf89e0503fef6028 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/isaac1000000
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@f84570b28d4db625c46f2be8bf89e0503fef6028 -
Trigger Event:
release
-
Statement type:
File details
Details for the file turtlebyte-0.2.0-py3-none-any.whl.
File metadata
- Download URL: turtlebyte-0.2.0-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
191f866da0c6d1b885c7836f004c041d8f8cd9cdc74fcbd6515d00c03f635a98
|
|
| MD5 |
ff227f6931e43594fc152d41d92c6123
|
|
| BLAKE2b-256 |
4b4471a62820c369ae8eba4f2401aef8ce875888309a1f004bd4a5a64b43369e
|
Provenance
The following attestation bundles were made for turtlebyte-0.2.0-py3-none-any.whl:
Publisher:
python-publish.yml on isaac1000000/turtlebyte
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
turtlebyte-0.2.0-py3-none-any.whl -
Subject digest:
191f866da0c6d1b885c7836f004c041d8f8cd9cdc74fcbd6515d00c03f635a98 - Sigstore transparency entry: 246698354
- Sigstore integration time:
-
Permalink:
isaac1000000/turtlebyte@f84570b28d4db625c46f2be8bf89e0503fef6028 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/isaac1000000
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@f84570b28d4db625c46f2be8bf89e0503fef6028 -
Trigger Event:
release
-
Statement type: