Skip to main content

Simple turtle graphics library with 3D integration

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

BoxTurtle v1.1.6

BoxTurtle will automatically import and translate all regular turtle functions. This means that you do not have to import turtle on it's own to perform any regular turtle functions, just use BoxTurtle.

For example, you do not have to do:

import turtle
import BoxTurtle
turtle.bgcolor("white")
BoxTurtle.goto(0, 30, 0)
turtle.done()

You can simply do:

import BoxTurtle
BoxTurtle.bgcolor("white")
BoxTurtle.goto(0, 30, 0)
BoxTurtle.done()

However, even though BoxTurtle will import turtle on its own, you must have turtle installed with your version of Python.


Note: I did not write any original turtle commands, I just redefined them. The only functions that I wrote on my own are the ones documented below, all of which were written using various different functions from the original turtle library. All credit goes to the creators of the original turtle module, and for information on the usage of any turtle functions not shown below, please consult documentation for the original turtle library.


Functions:


  • goto(x, y, z)

As with the original turtle module, the goto function makes the turtle travel to the point specified. However, now it must account for the z axis as well. This means that goto now takes three arguments (x, y and z) instead of just two (x and y).

BoxTurtle.goto(x, y, z)

Example:

BoxTurtle.goto(0, 30, 0)

(Turtle will travel to 0, 30, 0)


  • line(startX, startY, startZ, endX, endY, endZ)

Draws a line from a point defined by startX, startY and startZ to a point definded by endX, endY and endZ.

BoxTurtle.line(startX, startY, startZ, endX, endY, endZ)

Example:

BoxTurtle.line(0, -30, 0, 0, 30, 0)

(Draws a line from 0, -30, 0 to 0, 30, 0)


  • cube(x, y, z, size)

Draws a three dimensional cube. The first three arguments, x, y and z, define the point of which the center of the cube will be located. Note that unlike the square function in the original turtle module, this is NOT where the corner of the cube is, but where the center of the cube is, meaning the cube will be centered at that point. Size will determine the length of each edge of the cube. If no parameters are set, they will automatically be set as (0, 0, 0, 10)

BoxTurtle.cube(x, y, z, size)

Example:

BoxTurtle.cube(0, 0, 0, 10)

(Creates a cube centered at 0, 0, 0 with a height, width and length of 10)


  • rotate(x, y, z)

Rotate the position of the turtle around any of the three axis. It takes three arguments, x, y, and z. The function will modify the rotation around each axis by the number stated. Note that it rotates AROUND each axis, so increasing x rotation will rotate flip it up, increasing y rotation will flip left, etc. This will also only rotate anything rendered after the function call, so all previous points will remain the same untill clear() is called.

BoxTurtle.rotate(x, y, z)

Example:

BoxTurtle.rotate(0, 5, 0)
BoxTurtle.cube(0, 0, 0, 10)

(This will create a cube that has been rotated around the x axis slightly)


  • stampaxis(size)

Draw the x, y and z axis on the plane to help to show rotations. Note that this will not update when rotations are increased or decreased, and can only be hidden by calling clear(). It effectively acts the same as the regular stamp() method, only it draws the axis instead of the turtle. The function takes an argument for size, but if none is given it will default to 20.

BoxTurtle.stampaxis(size)

Example:

BoxTurtle.stampaxis(20)

(Will draw the x, y and z axis scaled to 20)


  • movecam(x, y, z)

Move the camera through the plane. The function takes three arguments, one for x, y, and z, and each determine how much the cam is moved. Just like the rotate function, this only applies to anything drawn after the function is called.

BoxTurtle.movecam(x, y, z)

Example:

BoxTurtle.movecam(5, -5, 0)

*(Will move the cam right 5 and down 5)


  • Other functions

Note: The functions listed below are the only functions from the original turtle module usable BoxTurtle library. Any other functions that you wish to use from the original turtle library can only be used if you import the turtle library seperatly. Be wary of doing this, as it may override any functions called from BoxTurtle or cause errors.

Once again, I do not claim credit for any of the functions in this library shown below, I simply imported the turtle package and redefined them so they could be used in combonation with BoxTurtle. The only functions I wrote are the ones displayed above, all of which were written using the 3D projection formula and existing turtle functions.


bgcolor()

speed()

title()

done()

penup()

pendown()

color()

pensize()

clear()

tracer()

Note: tracer() can now only take one argument. In order to turn off refreshing use tracer(False), or tracer(True) to turn it back on.

update()

Screen()

Turtle()

mainloop()

setup()

stamp()

BoxTurtle()

exitonclick()

bye()


Build v1.1.6


GitHub: https://github.com/chadwickjr


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

BoxTurtle-1.1.6.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

BoxTurtle-1.1.6-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file BoxTurtle-1.1.6.tar.gz.

File metadata

  • Download URL: BoxTurtle-1.1.6.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.5

File hashes

Hashes for BoxTurtle-1.1.6.tar.gz
Algorithm Hash digest
SHA256 bb1dc011f986d25bcd5f08c2220b946c61a53cfd8c30db713b9897541122491c
MD5 f26575d420043c855cbd37d0c6c31dd4
BLAKE2b-256 cf3a055fd1ef74f39e3150edaac3e0d508b63b4b45d2c87ba4bf60f969511d41

See more details on using hashes here.

File details

Details for the file BoxTurtle-1.1.6-py3-none-any.whl.

File metadata

  • Download URL: BoxTurtle-1.1.6-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.5

File hashes

Hashes for BoxTurtle-1.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 ab62486c2691a49e8f11f8956f7978413a58cf3cccd3ba10af70d719d89e1b68
MD5 e9e87e0c7a7d1e781fc5b6f1ab953ff2
BLAKE2b-256 460d6170966d3bf3bb7b2d53d2c1dcd43f84913bcf2456797429ec6a53d32906

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