web3-starter-py/web2_projects/magic-pen
osiris account 69bb4175f1 💾
2023-03-12 15:29:57 -07:00
..
data 💾 2023-03-12 15:29:57 -07:00
src 💾 2023-03-12 15:29:57 -07:00
.env_example 💾 2023-03-12 15:29:57 -07:00
.gitignore 💾 2023-03-12 15:29:57 -07:00
Makefile 💾 2023-03-12 15:29:57 -07:00
README.md 💾 2023-03-12 15:29:57 -07:00
requirements.txt 💾 2023-03-12 15:29:57 -07:00
setup.py 💾 2023-03-12 15:29:57 -07:00
tox.ini 💾 2023-03-12 15:29:57 -07: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!