Skip to main content

Coordinate Canvas

Interactive canvas that allows you to draw 2D coordinates in a plane and output their corresponding coordinates to a JSON file.

Installation

python -m pip install coordinate-canvas  # Use dash instead of underscore!

Usage

You can display the help message by running the following command:

python -m coordinate_canvas --help  # Use underscore instead of dash!

Once the canvas has been opened, you will be able to click on any part of it and add a new coordinate. Lines can be switched using the numeric pad on the keyboard, as explained on the header of the window.

Once you have added all the desired coordinates, just press the "Escape" or "Q" keys or close the window. A JSON file will be generated containing all the coordinates you added. This is how the JSON structure looks like:

{
    "line_1": {
        "x": [
            3.064516129032258,
            5.510752688172044,
            10.45698924731183,
            14.045698924731184,
            ...
        ],
        "y": [
            8.837828837828837,
            13.18015318015318,
            13.126873126873129,
            8.03862803862804,
            ...
        ]
    },
    "line_2": {
        ...
    },
    ...
}

Data retrieval

JSON data can easily be retrieved with a few lines of code.

import json

# Assuming the script is located in the same directory where the program is
#   being executed (if not, modify the path below):
with open("coordinates.json", mode="r", encoding="utf-8") as fp:
    data = json.load(fp)  # Loads all data in a dictionary.

# Ways to retrieve data:
line_1 = data["line_1"]
line_1_x = data["line_1"]["x"]
line_1_y = data["line_1"]["y"]
line_1_xy = [(x, y) for x, y in zip(data["line_1"].values())]  # Recommended!

Contributing

If you are planning on contributing to the repository, take a look at the contribution guidelines.

Metadata

Release files for coordinate-canvas 1.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for coordinate-canvas 1.5.1
File Size Uploaded
coordinate-canvas-1.5.1.tar.gz 44.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for coordinate-canvas 1.5.1
File Interpreter ABI Platform
coordinate_canvas-1.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 77.7 kB

Release files / coordinate-canvas-1.5.1.tar.gz

Download URL coordinate-canvas-1.5.1.tar.gz
Size 44.3 kB
Tags Source
SHA-256 checksum
How to use checksums
de46d6dbddc1fd2f09223da230511f8f361d9629e5a68afa34ba2cd34fe39a0b
BLAKE2b-256 checksum
How to use checksums
91dc6c125fb3a6b52e3ef0207a184f17fb9da10763c0b99a98a05306be0f796b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / coordinate_canvas-1.5.1-py3-none-any.whl

Download URL coordinate_canvas-1.5.1-py3-none-any.whl
Size 33.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
343b2d7a7514b9ec423eaeb9cb5e99009ad18afb286e333b101eb8b036f2b1f7
BLAKE2b-256 checksum
How to use checksums
bfcc3570d4f98214faf3c90bcd574d9d7e31bc670f720cd4909e6ea7b3ef4e5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release history Release notifications | RSS feed

This release

1.5.1 This release

2 release files

1.5.0

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page