turtlePlus2
turtlePlus is an enhanced drawing toolkit built on top of Python’s turtle module, designed to simplify geometric visualization and improve drawing flexibility with trutle.
It extends the native turtle API with higher-level abstractions such as line styles, point labeling, automatic scaling, and viewport management. With turtlePlus, you can create clean, well-structured diagrams more efficiently—especially for educational demos, mathematical illustrations, and GUI prototyping.
Whether you are teaching, learning, or building visual tools, turtlePlus helps you focus on the logic of your graphics instead of low-level drawing details.
English | 简体中文
Features
1. Move Forward
Like turtle, the fd function is used to move the cursor and draw in a specified way. It is fully compatible with turtle and adds many new features.
- In turtle, line style control relies entirely on manually using
penupandpendown. turtlePlus encapsulates this into commonly used modes:LineModes.none,LineModes.solid, andLineModes.dotted, representing no line (pen up), solid line, and dashed line. Of course, you can still usepenupand similar methods for precise control. - In simple GUI demonstrations, it is often necessary to label points. turtle natively supports marking points and writing text at stopping positions.
Function parameters and their meanings:
fd(length,
line_width=DEFAULT.LINE_WIDTH,
line_color=Colors.black,
line_mode=LineModes.solid,
write_name="", name_align=Align.LEFT,
name_vertical_align=VerticalAlign.TOP,
if_dot_at_end=True,
dot_color=Colors.black,
dot_diameter=DEFAULT.DOT_DIAMETER,
dotted_line_length=DEFAULT.DOTTED_LINE_LENGTH,
dotted_gap=DEFAULT.DOTTED_GAP
)
length[required]: Distance to move forward.line_width: Width of the line drawn along the path.line_color: Color of the line.line_mode: Line style. Built-in options include solid, dotted, and none (no drawing).write_name: Whether to label the endpoint. Default is no label.name_align: Horizontal alignment of the label (default: left).name_vertical_align: Vertical alignment of the label (default: top).if_dot_at_end: Whether to draw a dot at the endpoint (default: true).dot_color: Color of the endpoint dot.dot_diameter: Radius of the endpoint dot.dotted_line_length: Length of each dash in a dotted line.dotted_gap: Gap between dashes.
2. Go to a Coordinate
You can use the goto function to move the cursor to a specified coordinate and draw.
Like fd, it supports many additional features.
goto(target_point,
line_mode,
line_width,
line_color,
write_name, name_height=DEFAULT.FONT_HEIGHT,
name_align=Align.LEFT, name_vertical_align=VerticalAlign.TOP,
name_color=DEFAULT.FONT_COLOR,
if_dot_at_end=True, dot_color=Colors.black,
dot_diameter=DEFAULT.DOT_DIAMETER,
dotted_line_length=DEFAULT.DOTTED_LINE_LENGTH,
dotted_gap=DEFAULT.DOTTED_GAP
)
target_point: Target coordinate, a list in the form[x, y].line_width: Width of the drawn line.line_color: Color of the line.line_mode: Line style (solid, dotted, or none).write_name: Whether to label the endpoint (default: no label).name_height: Font size of the label.name_align: Horizontal alignment (default: left).name_vertical_align: Vertical alignment (default: top).name_color: Font color.if_dot_at_end: Whether to draw a dot at the endpoint (default: true).dot_color: Color of the dot.dot_diameter: Radius of the dot.dotted_line_length: Length of each dash.dotted_gap: Gap between dashes.
3. Draw Text
The write function is used to render text in the drawing, for example to create diagrams like this:
Function parameters:
write(string,
pos=None,
align=Align.LEFT,
vertical_align=DEFAULT.FONT_VERTICAL_ALIGN,
font_height=DEFAULT.FONT_HEIGHT,
font_color=DEFAULT.FONT_COLOR,
font_family=DEFAULT.FONT_FAMILY,
font_weight=DEFAULT.FONT_WEIGHT)
string: Text to draw.pos: Position to draw the text.align: Horizontal alignment.vertical_align: Vertical alignment.font_height: Font size.font_color: Font color.font_family: Font family.font_weight: Font weight.
4. Scale Viewport
Since the size of drawings may not match screen resolution, turtle drawings may appear too large (overflowing the screen) or too small (hard to see). turtlePlus introduces viewport scaling to solve this issue.
Use the set_scale() function to scale the viewport.
set_scale(scale_value)
scale_value: Scaling factor (must be greater than 0).
5. Auto Scaling
turtlePlus provides automatic scaling. By passing all points of the drawing, it calculates an appropriate scale so the figure fits the screen without manual adjustment.
auto_scaling(points_pos)
points_pos: Coordinates of all points in the drawing.
The left image shows no scaling; the right shows scaling applied.
6. Calculate Distance
Calculates the distance between coordinates using the Pythagorean theorem.
⚠️ Not redundant — this function supports special coordinate formats and accounts for viewport scaling.
distance(point_1, point_2)
point_1,point_2: The two coordinates.
7. Auto Offset Viewport
Sometimes drawings are not centered due to their shape, resulting in poor visual appearance. turtlePlus introduces viewport offset to fix this.
Use the auto_offset function to adjust the viewport.
auto_offset(points_pos, offset_mode)
points_pos: All points of the drawing.offset_mode: Offset mode:Offset.at_start: Center on the starting pointOffset.center: Center on the geometric centerOffset.none: No offset
For example, using auto_offset(points, Offset.center) centers the drawing:
8. Ensure Best Appearance
Automatically handles both viewport offset and scaling to achieve the best display.
ensure_appearance(points_pos, offset_mode=OffsetMode.none)
points_pos: Points of the drawingoffset_mode: Viewport offset mode
This function combines auto_scaling and auto_offset for optimal display.
Metadata
Release files for turtlePlus2 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| turtleplus2-1.0.0.tar.gz | 10.5 kB | Without provenance | Details for turtleplus2-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| turtleplus2-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for turtleplus2-1.0.0-py3-none-any.whl |
Total release size: 19.3 kB
Release files / turtleplus2-1.0.0.tar.gz
| Download URL | turtleplus2-1.0.0.tar.gz |
|---|---|
| Size | 10.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
da5607d1f6753c2a46c8641f14002a6fdb1e6bf0fd205a3485f5724b1d5f58d9
|
|
BLAKE2b-256 checksum How to use checksums |
ba871bdcd73985a702b1f9bd2ec585346d5a371cb7c3d35ae42be76f8b3a48f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Release files / turtleplus2-1.0.0-py3-none-any.whl
| Download URL | turtleplus2-1.0.0-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
419c97f9a7b6d4a04f772c3e0fb7582008ec33f928cac7d958ed3879a2a51295
|
|
BLAKE2b-256 checksum How to use checksums |
745f42b4aaa252f90dd2f08966c098cb7409b139cd9ab112ef7bdb80acc982fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Security for turtlePlus2 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.