web3-starter-py/small-projects/magic-pen
mvonsteinkirch d24d37806d 💾
2022-12-24 14:51:10 -08:00
..
data Add dir with some small projects 2022-03-23 18:41:46 +04:00
src Add dir with some small projects 2022-03-23 18:41:46 +04:00
.env_example Add dir with some small projects 2022-03-23 18:41:46 +04:00
.gitignore Add dir with some small projects 2022-03-23 18:41:46 +04:00
Makefile Add dir with some small projects 2022-03-23 18:41:46 +04:00
README.md Add dir with some small projects 2022-03-23 18:41:46 +04:00
requirements.txt Bump numpy from 1.18.1 to 1.21.0 in /small-projects/magic-pen 2022-03-23 17:00:34 +02:00
setup.py 💾 2022-12-24 14:51:10 -08:00
tox.ini Add dir with some small projects 2022-03-23 18:41:46 +04:00

Magic pen

This program creates an interface for a digital pen for drawing.


Installing

Create and source virtual enviroment. You can use virtualenv or conda:

virtualenv venv
source venv/bin/activate

Create and customize an enviroment file:

cp .env_example .env
vim .env

Install dependencies:

make setup

Install EPen:

make install

Usage

Edit the stream data to be read by the program:

vim data/InputStream.txt

Run this program with:

make run

or simply

epen

These commands run ./src/main.py, which calls a class called Epen(). This is the main class that defines all the functionalities of this application.


Examples

The stream:

F0A04000417F4000417FC040004000804001C05F205F20804000

prints

CLR;
CO 0 255 0 255;
MV (0, 0);
PEN DOWN;
MV (4000, 4000);
PEN UP;

The stream:

F0A0417F40004000417FC067086708804001C0670840004000187818784000804000

prints

CLR;
CO 255 0 0 255;
MV (5000, 5000);
PEN DOWN;
MV (8191, 5000);
PEN UP;
MV (8191, 0);
PEN DOWN;
MV (5000, 0);
PEN UP;

And the stream:

F0A040004000417F417FC04000400080400047684F5057384000804001C05F204000400001400140400040007E405B2C4000804000

prints

CLR;
CO 0 0 255 255;
MV (0, 0);
PEN DOWN;
MV (4000, 0) (4000, -8000) (-4000, -8000) (-4000, 0) (-500, 0);
PEN UP;
(base)

Developer

Linting

You can lint the code with:

make lint

Cleaning up

Clean residual compilation and installation files with:

make clean

Thank you for reading my code!