Skip to main content

The utility for drawing coordinate grid on python turtle's screen.

Project description

TurtleGridUtil

TurtleGridUtil is a Python utility for drawing customizable coordinate grids using the Turtle graphics library. It provides an easy way to create visual grids for educational purposes, graphing, or any project that requires a coordinate system.

source code on github

Features

  • Draw major and minor grid lines
  • Customizable line colors and widths
  • Adjustable grid spacing
  • Scale markers with customizable font and style
  • Optional scale point markers

Installation

Use pip install turtlegridutil for installing

Usage

Here's a basic example of how to use TurtleGridUtil:

import turtle
from turtlegridutil import draw_grid

# Create a turtle screen
screen = turtle.Screen()
screen.title("Grid Drawing")
screen.setup(width=800, height=600)

# Draw the grid
draw_grid(screen, major_line_step=50, minor_line_step=10)

# Keep the window open
turtle.done()

API Reference

draw_grid(screen, **kwargs)

Draws a coordinate grid on the given turtle screen.

Parameters:

screen (turtle.Screen): The turtle screen object on which to draw the grid.
major_line_step (int): The distance between major grid lines. Default is 100.
minor_line_step (int): The distance between minor grid lines. If 0, no minor lines are drawn. Default is 0.
major_line_color (str): The color of major grid lines. Default is "black".
minor_line_color (str): The color of minor grid lines. Default is "gray".
major_line_width (int): The width of major grid lines. Default is 1.
minor_line_width (int): The width of minor grid lines. Default is 1.
use_scale (bool): Whether to draw scale markers and labels. Default is True.
scale_step (int): The interval for placing scale markers and labels. If 0, uses major_line_step. Default is 0.
font_color (str): The color of the scale labels. Default is "black".
font_family (str): The font family for scale labels. Default is "Arial".
font_size (int): The font size for scale labels. Default is 14.
font_style (str): The font style for scale labels (e.g., "normal", "bold", "italic"). Default is "normal".
scale_points_size (int): The size of the dots marking scale points. If 0, no dots are drawn. Default is 5.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

turtlegridutil-0.1.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

turtlegridutil-0.1.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file turtlegridutil-0.1.0.tar.gz.

File metadata

  • Download URL: turtlegridutil-0.1.0.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.13.1 Windows/11

File hashes

Hashes for turtlegridutil-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0935e2cd7504d826519c21ea296448515c95f3e4bbc97994d4b3d23ae7548c92
MD5 2b71d95bf69c02e63b67702054e72db4
BLAKE2b-256 d11f77037abd0e5d88e269bcb961d60df740a29c6fa40146f9d655a8bff314bf

See more details on using hashes here.

File details

Details for the file turtlegridutil-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: turtlegridutil-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.13.1 Windows/11

File hashes

Hashes for turtlegridutil-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7af3844d74c1cb6c90c2afadb2af1e297af2471ceb83bdefbe8d028e453afcff
MD5 039de44522e8f15867fdbc642142298b
BLAKE2b-256 fa9a48cee5c2406a383ac1903b489f9016bf22fddf2ae71ff0ab69e2744adbd9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page